def dumps(self, obj):
        raw_data = super(EncryptingPickleSerializer, self).dumps(obj)
        if getattr(settings, 'COMPRESS_ENCRYPTED_COOKIE', False):
            level = getattr(settings, 'ENCRYPTED_COOKIE_COMPRESSION_LEVEL', 6)
            raw_data = zlib.compress(raw_data, level)

        return bytes(crypto.encrypt(raw_data))
Exemplo n.º 2
0
 def dumps(self, obj):
     raw_data = super(EncryptingPickleSerializer, self).dumps(obj)
     if getattr(settings, 'COMPRESS_ENCRYPTED_COOKIE', False):
         level = getattr(settings, 'ENCRYPTED_COOKIE_COMPRESSION_LEVEL', 6)
         raw_data = zlib.compress(raw_data, level)
     return crypto.encrypt(raw_data)
 def dumps(self, obj):
     raw_data = self._serializer.dumps(obj)
     if getattr(settings, 'COMPRESS_ENCRYPTED_COOKIE', False):
         level = getattr(settings, 'ENCRYPTED_COOKIE_COMPRESSION_LEVEL', 6)
         raw_data = zlib.compress(raw_data, level)
     return crypto.encrypt(raw_data)