示例#1
0
 def make_persistent(self, instance):
     print 'Make persistent called with %s' % (instance,)
     if not IPersistent.providedBy(instance):
         print '\tIPersistent not provided, directly providing'
         directly_provides(instance, IPersistent)
     persistent = IPersistentObject(instance)
     self._configure_persistence(persistent)
     persistent.set_unsaved()
     self.notify_modified(instance)
示例#2
0
 def make_persistent(self, instance):
     print 'Make persistent called with %s' % (instance, )
     if not IPersistent.providedBy(instance):
         print '\tIPersistent not provided, directly providing'
         directly_provides(instance, IPersistent)
     persistent = IPersistentObject(instance)
     self._configure_persistence(persistent)
     persistent.set_unsaved()
     self.notify_modified(instance)
示例#3
0
 def get_oid(self, instance):
     print 'get_oid(%s)' % (instance,)
     if isinstance(instance, _never_persistent):
         print '\t-> None, is instance of _never_persistent'
         return None
     if type(instance) in (dict, list):
         print '\t-> None, type in dict, list'
         return None
     if not IPersistent.providedBy(instance):
         print '\t-> None, IPersistent not provided by instance'
         return None
     persistent = IPersistentObject(instance)
     if persistent.get_oid() is None:
         self._configure_persistence(persistent)
         persistent.set_loaded()
         persistent.set_unsaved()
     elif not persistent.is_persistent():
         print '\t-> None, not persistent.is_persistent()'
         return None
     oid = persistent.get_oid()
     print '\t%s OID => %s' % (instance, oid)
     return oid
示例#4
0
 def get_oid(self, instance):
     print 'get_oid(%s)' % (instance, )
     if isinstance(instance, _never_persistent):
         print '\t-> None, is instance of _never_persistent'
         return None
     if type(instance) in (dict, list):
         print '\t-> None, type in dict, list'
         return None
     if not IPersistent.providedBy(instance):
         print '\t-> None, IPersistent not provided by instance'
         return None
     persistent = IPersistentObject(instance)
     if persistent.get_oid() is None:
         self._configure_persistence(persistent)
         persistent.set_loaded()
         persistent.set_unsaved()
     elif not persistent.is_persistent():
         print '\t-> None, not persistent.is_persistent()'
         return None
     oid = persistent.get_oid()
     print '\t%s OID => %s' % (instance, oid)
     return oid