Ejemplo n.º 1
0
 def _before_flush(self, session, context, instances):
     for item in session.dirty:
         Audit.create_version(item, session, 'updated', self.accl_key)
         if isinstance(item, Versioned):
             item._version_ = (item._version_ or 0) + 1
             item._version_by_ = self.accl_key
             item._version_on_ = datetime.datetime.now()
     for item in session.new:
         if isinstance(item, Versioned):
             item._version_by_ = self.accl_key            
     for item in session.deleted:
         Audit.create_version(item, session, 'deleted', self.accl_key)
Ejemplo n.º 2
0
 def _after_flush(self, session, context):
     for item in session.new:
         if not isinstance(item, Audit):
             Audit.create_version(item, session, 'created', self.accl_key)
         else:
             self._audit_broadcast_.append(utils.dumps(item._serialize))