Exemple #1
0
 def _load(self):
     """Load data from the database."""
     namespace = SessionNamespaceObject()
     namespace['id'] = self.m_session
     namespace['scope'] = self.m_scope
     namespace['data'] = dumps({})
     # Futher locking is not necessary as the session record has already
     # been locked.
     namespace = self.m_transaction.merge(namespace, lock=False)
     self.m_namespace = namespace
     data = loads(namespace['data'])
     self.update(data)
Exemple #2
0
 def flush(self):
     """Sync data back to the database."""
     if not self.m_dirty:
         return
     self.m_namespace['data'] = dumps(self.copy())