summaryrefslogtreecommitdiff
path: root/examples/pickle/custom_pickler.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/pickle/custom_pickler.py')
-rw-r--r--examples/pickle/custom_pickler.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/pickle/custom_pickler.py b/examples/pickle/custom_pickler.py
index b45e16e7c..0a32bfd03 100644
--- a/examples/pickle/custom_pickler.py
+++ b/examples/pickle/custom_pickler.py
@@ -1,6 +1,7 @@
"""illustrates one way to use a custom pickler that is session-aware."""
from sqlalchemy import *
+from sqlalchemy.orm import *
from sqlalchemy.orm.session import object_session
from cStringIO import StringIO
from pickle import Pickler, Unpickler
@@ -12,13 +13,13 @@ meta.bind.echo = True
class MyExt(MapperExtension):
def populate_instance(self, mapper, selectcontext, row, instance, identitykey, isnew):
MyPickler.sessions.current = selectcontext.session
- return EXT_PASS
+ return EXT_CONTINUE
def before_insert(self, mapper, connection, instance):
MyPickler.sessions.current = object_session(instance)
- return EXT_PASS
+ return EXT_CONTINUE
def before_update(self, mapper, connection, instance):
MyPickler.sessions.current = object_session(instance)
- return EXT_PASS
+ return EXT_CONTINUE
class MyPickler(object):
sessions = threading.local()