Re-implemented copyreg picklers/unpicklers for DAL and Reference classes (due to errors on sessions)

This commit is contained in:
gi0baro
2014-09-03 14:48:26 +02:00
parent 5e5e649c28
commit 625e4849ef
3 changed files with 29 additions and 3 deletions
+11 -1
View File
@@ -142,7 +142,7 @@ import copy
import traceback
import glob
from ._compat import pickle, hashlib_md5, pjoin, ogetattr, osetattr
from ._compat import pickle, hashlib_md5, pjoin, ogetattr, osetattr, copyreg
from ._globals import GLOBAL_LOCKER, THREAD_LOCAL, LOGGER, DEFAULT
from ._load import have_serializers, serializers, is_jdbc, OrderedDict
from .helpers.classes import SQLCallableList
@@ -1081,3 +1081,13 @@ class DAL(object):
break
else:
raise RuntimeError("Unable to import table that does not exist.\nTry db.import_from_csv_file(..., map_tablenames={'table':'othertable'},ignore_missing_tables=True)")
def DAL_unpickler(db_uid):
return DAL('<zombie>', db_uid=db_uid)
def DAL_pickler(db):
return DAL_unpickler, (db._db_uid,)
copyreg.pickle(DAL, DAL_pickler, DAL_unpickler)