From bb9403e2b2f4fc97b1a558db8aa38be5d31f73ab Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Sat, 16 May 2015 00:46:22 -0400 Subject: [PATCH] DjangoDb: typo, added logger --- gramps/gen/dbstate.py | 11 +++++++++++ gramps/plugins/database/djangodb.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gramps/gen/dbstate.py b/gramps/gen/dbstate.py index 0d9c30d4a..85722464d 100644 --- a/gramps/gen/dbstate.py +++ b/gramps/gen/dbstate.py @@ -29,6 +29,14 @@ from .proxy.proxybase import ProxyDbBase from .utils.callback import Callback from .config import config +#------------------------------------------------------------------------- +# +# set up logging +# +#------------------------------------------------------------------------- +import logging +LOG = logging.getLogger(".dbstate") + class DbState(Callback): """ Provide a class to encapsulate the state of the database. @@ -152,6 +160,7 @@ class DbState(Callback): ## Work-around for databases that need sys refresh (django): def modules_is_set(self): + LOG.warn("modules_is_set?") if hasattr(self, "_modules"): return self._modules != None else: @@ -159,6 +168,7 @@ class DbState(Callback): return False def reset_modules(self): + LOG.warn("reset_modules!") # First, clear out old modules: for key in list(sys.modules.keys()): del(sys.modules[key]) @@ -167,5 +177,6 @@ class DbState(Callback): sys.modules[key] = self._modules[key] def save_modules(self): + LOG.warn("save_modules!") self._modules = sys.modules.copy() diff --git a/gramps/plugins/database/djangodb.py b/gramps/plugins/database/djangodb.py index f7fe47892..c28cc9265 100644 --- a/gramps/plugins/database/djangodb.py +++ b/gramps/plugins/database/djangodb.py @@ -1670,7 +1670,7 @@ class DbDjango(DbWriteBase, DbReadBase, UpdateCallback, Callback): as part of the transaction. """ if self.use_import_cache: - self.import_cache[obj.handle] = media + self.import_cache[media.handle] = media else: raw = media.serialize() items = self.dji.Media.filter(handle=media.handle)