2017-01-07 19:11:46 +08:00
|
|
|
import pickle
|
2015-01-28 20:35:27 +08:00
|
|
|
|
2017-01-07 19:11:46 +08:00
|
|
|
from django.core.signing import JSONSerializer as BaseJSONSerializer
|
2013-08-22 08:12:19 +08:00
|
|
|
|
|
|
|
|
2017-01-19 15:39:46 +08:00
|
|
|
class PickleSerializer:
|
2013-08-22 08:12:19 +08:00
|
|
|
"""
|
|
|
|
Simple wrapper around pickle to be used in signing.dumps and
|
|
|
|
signing.loads.
|
|
|
|
"""
|
|
|
|
def dumps(self, obj):
|
|
|
|
return pickle.dumps(obj, pickle.HIGHEST_PROTOCOL)
|
|
|
|
|
|
|
|
def loads(self, data):
|
|
|
|
return pickle.loads(data)
|
|
|
|
|
|
|
|
|
|
|
|
JSONSerializer = BaseJSONSerializer
|