def test_serialize_path(self): users, addresses = (self.tables.users, self.tables.addresses) umapper = mapper(User, users, properties={ 'addresses':relationship(Address, backref="user") }) amapper = mapper(Address, addresses) # this is a "relationship" path with mapper, key, mapper, key p1 = (umapper, 'addresses', amapper, 'email_address') eq_( interfaces.deserialize_path(interfaces.serialize_path(p1)), p1 ) # this is a "mapper" path with mapper, key, mapper, no key # at the end. p2 = (umapper, 'addresses', amapper, ) eq_( interfaces.deserialize_path(interfaces.serialize_path(p2)), p2 ) # test a blank path p3 = () eq_( interfaces.deserialize_path(interfaces.serialize_path(p3)), p3 )
def __getstate__(self): return { 'instance': self.instance, 'key': self.key, 'options': self.options, 'path': serialize_path(self.path) }
def __getstate__(self): d = {'instance': self.obj()} d.update((k, self.__dict__[k]) for k in ('committed_state', 'pending', 'parents', 'modified', 'expired', 'callables', 'key', 'load_options', 'mutable_dict') if k in self.__dict__) if self.load_path: d['load_path'] = interfaces.serialize_path(self.load_path) return d
def __getstate__(self): d = { "instance": self.obj(), "class_": self.class_, "load_options": self.load_options, "load_path": self.load_path, } if self.load_path: d['load_path'] = interfaces.serialize_path(self.load_path) return d
def __getstate__(self): d = {'instance':self.obj()} d.update( (k, self.__dict__[k]) for k in ( 'committed_state', 'pending', 'parents', 'modified', 'expired', 'callables', 'key', 'load_options', 'mutable_dict' ) if k in self.__dict__ ) if self.load_path: d['load_path'] = interfaces.serialize_path(self.load_path) return d
def __getstate__(self): d = {"instance": self.obj()} d.update( (k, self.__dict__[k]) for k in ("committed_state", "pending", "parents", "modified", "expired", "callables") if self.__dict__[k] ) d.update( (k, self.__dict__[k]) for k in ("key", "load_options", "expired_attributes", "mutable_dict") if k in self.__dict__ ) if self.load_path: d["load_path"] = interfaces.serialize_path(self.load_path) return d
def __getstate__(self): d = {"instance": self.obj()} d.update( (k, self.__dict__[k]) for k in ( "committed_state", "pending", "modified", "expired", "callables", "key", "parents", "load_options", "mutable_dict", "class_", ) if k in self.__dict__ ) if self.load_path: d["load_path"] = interfaces.serialize_path(self.load_path) self.manager.dispatch.pickle(self, d) return d
def __getstate__(self): return (self.state, self.key, self.options, serialize_path(self.path))
def __getstate__(self): return {'instance':self.instance, 'key':self.key, 'options':self.options, 'path':serialize_path(self.path)}