DjangoDb: typo, added logger

This commit is contained in:
Doug Blank 2015-05-16 00:46:22 -04:00
parent 576db27e9d
commit cfb33ec1a2
2 changed files with 12 additions and 1 deletions

View File

@ -29,6 +29,14 @@ from .proxy.proxybase import ProxyDbBase
from .utils.callback import Callback from .utils.callback import Callback
from .config import config from .config import config
#-------------------------------------------------------------------------
#
# set up logging
#
#-------------------------------------------------------------------------
import logging
LOG = logging.getLogger(".dbstate")
class DbState(Callback): class DbState(Callback):
""" """
Provide a class to encapsulate the state of the database. 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): ## Work-around for databases that need sys refresh (django):
def modules_is_set(self): def modules_is_set(self):
LOG.warn("modules_is_set?")
if hasattr(self, "_modules"): if hasattr(self, "_modules"):
return self._modules != None return self._modules != None
else: else:
@ -159,6 +168,7 @@ class DbState(Callback):
return False return False
def reset_modules(self): def reset_modules(self):
LOG.warn("reset_modules!")
# First, clear out old modules: # First, clear out old modules:
for key in list(sys.modules.keys()): for key in list(sys.modules.keys()):
del(sys.modules[key]) del(sys.modules[key])
@ -167,5 +177,6 @@ class DbState(Callback):
sys.modules[key] = self._modules[key] sys.modules[key] = self._modules[key]
def save_modules(self): def save_modules(self):
LOG.warn("save_modules!")
self._modules = sys.modules.copy() self._modules = sys.modules.copy()

View File

@ -1670,7 +1670,7 @@ class DbDjango(DbWriteBase, DbReadBase, UpdateCallback, Callback):
as part of the transaction. as part of the transaction.
""" """
if self.use_import_cache: if self.use_import_cache:
self.import_cache[obj.handle] = media self.import_cache[media.handle] = media
else: else:
raw = media.serialize() raw = media.serialize()
items = self.dji.Media.filter(handle=media.handle) items = self.dji.Media.filter(handle=media.handle)