Commits

mikeycgto  committed a071519
  • Participants
  • Parent commits 257f147

Comments (0)

Files changed (2)

File beaker/session.py

             nonce = b64encode(os.urandom(40))[:8]
             encrypt_key = crypto.generateCryptoKeys(self.encrypt_key,
                                              self.validate_key + nonce, 1)
-            data = util.pickle.dumps(self.copy(), 2)
+            data = util.json.dumps(self.copy())
             return nonce + b64encode(crypto.aesEncrypt(data, encrypt_key))
         else:
-            data = util.pickle.dumps(self.copy(), 2)
+            data = util.json.dumps(self.copy())
             return b64encode(data)
 
     def _decrypt_data(self):
                                              self.validate_key + nonce, 1)
             payload = b64decode(self.cookie[self.key].value[8:])
             data = crypto.aesDecrypt(payload, encrypt_key)
-            return util.pickle.loads(data)
+            return util.json.loads(data)
         else:
             data = b64decode(self.cookie[self.key].value)
-            return util.pickle.loads(data)
+            return util.json.loads(data)
 
     def save(self, accessed_only=False):
         """Saves the data for this session to persistent storage"""

File beaker/util.py

 else:
     import cPickle as pickle
 
+try:
+    import json
+except ImportError:
+    import simplejson as json
+
 from beaker.converters import asbool
 from beaker import exceptions
 from threading import local as _tlocal