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
+15 -1
View File
@@ -1,8 +1,10 @@
# -*- coding: utf-8 -*-
import copy
import marshal
import struct
import traceback
from .._compat import exists
from .._compat import exists, copyreg
from .._globals import LOGGER
@@ -45,6 +47,18 @@ class Reference(long):
self.__allocate()
self._record[key] = value
def Reference_unpickler(data):
return marshal.loads(data)
def Reference_pickler(data):
try:
marshal_dump = marshal.dumps(long(data))
except AttributeError:
marshal_dump = 'i%s' % struct.pack('<i', long(data))
return (Reference_unpickler, (marshal_dump,))
copyreg.pickle(Reference, Reference_pickler, Reference_unpickler)
class SQLCallableList(list):
def __call__(self):