From c2f0f5a063d6d61b948f9b8479036fa74a34ec66 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Thu, 10 Oct 2013 12:29:52 +0000 Subject: [PATCH] Updates to work with CLIManager; shell refinements svn: r23294 --- gramps/webapp/shell.py | 8 +++++--- gramps/webapp/utils.py | 7 ++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gramps/webapp/shell.py b/gramps/webapp/shell.py index db880c85c..8ca20da77 100644 --- a/gramps/webapp/shell.py +++ b/gramps/webapp/shell.py @@ -67,12 +67,14 @@ except RuntimeError: from gramps.webapp.grampsdb.models import * from gramps.webapp.grampsdb.forms import * 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.gen.datehandler import displayer, parser from gramps.webapp.utils import StyledNoteFormatter, parse_styled_text 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() dji = DjangoInterface() @@ -81,7 +83,7 @@ dp = parser.parse #import_file(db, # "/home/dblank/gramps/trunk/example/gramps/data.gramps", -# User()) +# GUser()) #snf = StyledNoteFormatter(db) #for n in Note.objects.all(): diff --git a/gramps/webapp/utils.py b/gramps/webapp/utils.py index d65c85aad..36abc5a06 100644 --- a/gramps/webapp/utils.py +++ b/gramps/webapp/utils.py @@ -55,6 +55,7 @@ import gramps.webapp.grampsdb.forms as forms from gramps.webapp import libdjango from gramps.webapp.dbdjango import DbDjango 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 db = DbDjango() -def register_plugins(): +def register_plugins(user): 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) pmgr = BasePluginManager.get_instance() return pmgr @@ -1487,7 +1488,7 @@ def update_last_changed(obj, user): obj.last_changed = datetime.datetime.now() obj.last_changed_by = user -register_plugins() +register_plugins(GUser()) # works after registering plugins: from gramps.plugins.docgen.htmldoc import HtmlDoc