Updates to work with CLIManager; shell refinements

svn: r23294
This commit is contained in:
Doug Blank 2013-10-10 12:29:52 +00:00
parent 3168711bbb
commit c2f0f5a063
2 changed files with 9 additions and 6 deletions

View File

@ -67,12 +67,14 @@ except RuntimeError:
from gramps.webapp.grampsdb.models import * from gramps.webapp.grampsdb.models import *
from gramps.webapp.grampsdb.forms import * from gramps.webapp.grampsdb.forms import *
from gramps.webapp.dbdjango import DbDjango from gramps.webapp.dbdjango import DbDjango
from gramps.webapp.reports import import_file from gramps.webapp.reports import import_file, export_file
from gramps.webapp.libdjango import DjangoInterface, totime, todate from gramps.webapp.libdjango import DjangoInterface, totime, todate
from gramps.gen.datehandler import displayer, parser from gramps.gen.datehandler import displayer, parser
from gramps.webapp.utils import StyledNoteFormatter, parse_styled_text from gramps.webapp.utils import StyledNoteFormatter, parse_styled_text
from gramps.gen.lib import StyledText from gramps.gen.lib import StyledText
#from gramps.cli.user import User from gramps.cli.user import User as GUser # gramps user
from django.db.models import Q
db = DbDjango() db = DbDjango()
dji = DjangoInterface() dji = DjangoInterface()
@ -81,7 +83,7 @@ dp = parser.parse
#import_file(db, #import_file(db,
# "/home/dblank/gramps/trunk/example/gramps/data.gramps", # "/home/dblank/gramps/trunk/example/gramps/data.gramps",
# User()) # GUser())
#snf = StyledNoteFormatter(db) #snf = StyledNoteFormatter(db)
#for n in Note.objects.all(): #for n in Note.objects.all():

View File

@ -55,6 +55,7 @@ import gramps.webapp.grampsdb.forms as forms
from gramps.webapp import libdjango from gramps.webapp import libdjango
from gramps.webapp.dbdjango import DbDjango from gramps.webapp.dbdjango import DbDjango
from gramps.gen.constfunc import cuni from gramps.gen.constfunc import cuni
from gramps.cli.user import User as GUser # gramps user
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -130,9 +131,9 @@ dd = displayer.display
dp = parser.parse dp = parser.parse
db = DbDjango() db = DbDjango()
def register_plugins(): def register_plugins(user):
dbstate = DbState() dbstate = DbState()
climanager = CLIManager(dbstate, False) # don't load db climanager = CLIManager(dbstate, setloader=False, user=user) # don't load db
climanager.do_reg_plugins(dbstate, None) climanager.do_reg_plugins(dbstate, None)
pmgr = BasePluginManager.get_instance() pmgr = BasePluginManager.get_instance()
return pmgr return pmgr
@ -1487,7 +1488,7 @@ def update_last_changed(obj, user):
obj.last_changed = datetime.datetime.now() obj.last_changed = datetime.datetime.now()
obj.last_changed_by = user obj.last_changed_by = user
register_plugins() register_plugins(GUser())
# works after registering plugins: # works after registering plugins:
from gramps.plugins.docgen.htmldoc import HtmlDoc from gramps.plugins.docgen.htmldoc import HtmlDoc