summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/attributes.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/attributes.py')
-rw-r--r--lib/sqlalchemy/attributes.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/sqlalchemy/attributes.py b/lib/sqlalchemy/attributes.py
index 1c4f07ac6..c709afe3d 100644
--- a/lib/sqlalchemy/attributes.py
+++ b/lib/sqlalchemy/attributes.py
@@ -300,14 +300,16 @@ class InstrumentedList(object):
self[:] = []
def __getstate__(self):
- """implemented to allow pickling, since __obj is a weakref."""
- return {'key':self.key, 'obj':self.obj, 'data':self.data, 'attr':self.attr}
+ """implemented to allow pickling, since __obj is a weakref, also the InstrumentedAttribute has callables
+ attached to it"""
+ return {'key':self.key, 'obj':self.obj, 'data':self.data}
def __setstate__(self, d):
- """implemented to allow pickling, since __obj is a weakref."""
+ """implemented to allow pickling, since __obj is a weakref, also the InstrumentedAttribute has callables
+ attached to it"""
self.key = d['key']
self.__obj = weakref.ref(d['obj'])
self.data = d['data']
- self.attr = d['attr']
+ self.attr = getattr(d['obj'].__class__, self.key)
obj = property(lambda s:s.__obj())