示例#1
0
    def checkPersistentIdHandlesDescriptor(self):
        from ZODB.serialize import ObjectWriter
        class P(Persistent):
            pass

        writer = ObjectWriter(None)
        self.assertEqual(writer.persistent_id(P), None)
示例#2
0
    def test_PersistentIdHandlesDescriptor(self):
        from ZODB.serialize import ObjectWriter
        class P(Persistent):
            pass

        writer = ObjectWriter(None)
        self.assertEqual(writer.persistent_id(P), None)
示例#3
0
 def persistent_id(self, obj):
     assert type(obj) is not Ghost
     oid = self.getOid(obj)
     if type(oid) is str:
         try:
             return self.oid_dict[oid]
         except KeyError:
             obj._p_activate()
     return ObjectWriter.persistent_id(self, obj)
 def persistent_id(self, obj):
   assert type(obj) is not Ghost
   oid = self.getOid(obj)
   if type(oid) is str:
     try:
       return self.oid_dict[oid]
     except KeyError:
       obj._p_activate()
   return ObjectWriter.persistent_id(self, obj)
示例#5
0
 def load_persistent(self, oid, klass):
   obj = ObjectReader.load_persistent(self, oid, klass)
   if self.oid_set is not None:
     if not self.lazy:
       self.oid_set.add(oid)
     obj._p_activate()
     self.oid_dict[oid] = oid_klass = ObjectWriter.persistent_id(self, obj)
     if oid_klass != (oid, klass):
       self.do_migrate = True
   return obj