Merge branch 'master' into python3
[wrw.git] / wrw / session.py
index 1e615e3..e7d8581 100644 (file)
@@ -1,5 +1,5 @@
 import threading, time, pickle, random, os
-import cookie, env
+from . import cookie, env
 
 __all__ = ["db", "get"]
 
@@ -11,7 +11,7 @@ def hexencode(str):
 
 def gennonce(length):
     nonce = ""
-    for i in xrange(length):
+    for i in range(length):
         nonce += chr(random.randint(0, 255))
     return nonce
 
@@ -86,7 +86,7 @@ class db(object):
     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:
@@ -204,7 +204,7 @@ class db(object):
         data = self.backdb[sessid]
         try:
             return pickle.loads(data)
-        except Exception, e:
+        except:
             raise KeyError()
 
     def freeze(self, sess):