import threading, time, pickle, random, os
-import cookie, env
+from . import cookie, env
__all__ = ["db", "get"]
def gennonce(length):
nonce = ""
- for i in xrange(length):
+ for i in range(length):
nonce += chr(random.randint(0, 255))
return nonce
def clean(self):
now = int(time.time())
with self.lock:
- clist = self.live.keys()
+ clist = list(self.live.keys())
for sessid in clist:
with self.lock:
try:
data = self.backdb[sessid]
try:
return pickle.loads(data)
- except Exception, e:
+ except:
raise KeyError()
def freeze(self, sess):