mirror of https://github.com/sgoudham/Enso-Bot.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
424 B
Python
21 lines
424 B
Python
import pickle
|
|
|
|
from django.core.signing import JSONSerializer as BaseJSONSerializer
|
|
|
|
|
|
class PickleSerializer:
|
|
"""
|
|
Simple wrapper around pickle to be used in signing.dumps and
|
|
signing.loads.
|
|
"""
|
|
protocol = pickle.HIGHEST_PROTOCOL
|
|
|
|
def dumps(self, obj):
|
|
return pickle.dumps(obj, self.protocol)
|
|
|
|
def loads(self, data):
|
|
return pickle.loads(data)
|
|
|
|
|
|
JSONSerializer = BaseJSONSerializer
|