Merge branch 'master' of git.dolda2000.com:/srv/git/r/wrw
authorFredrik Tolf <fredrik@dolda2000.com>
Sun, 5 Aug 2012 16:18:22 +0000 (18:18 +0200)
committerFredrik Tolf <fredrik@dolda2000.com>
Sun, 5 Aug 2012 16:18:22 +0000 (18:18 +0200)
wrw/cookie.py
wrw/proto.py
wrw/session.py

index 16ddf81..4f5071a 100644 (file)
@@ -1,4 +1,5 @@
-import Cookie
+import Cookie, time
+import proto
 
 __all__ = ["cookies", "get", "add"]
 
@@ -43,3 +44,5 @@ def get(req, name, default = None):
 
 def add(req, name, value, **kw):
     cookies(req).add(name, value, **kw)
+
+cdate = proto.httpdate
index 3d8b96e..b1f0ab3 100644 (file)
@@ -1,3 +1,5 @@
+import time
+
 statusinfo = {
     400: ("Bad Request", "Invalid HTTP request."),
     401: ("Unauthorized", "Authentication must be provided for the requested resource."),
index 273775b..43b9087 100644 (file)
@@ -168,7 +168,9 @@ class db(object):
         return session(threading.RLock())
 
     def mkcookie(self, req, sess):
-        cookie.add(req, self.cookiename, sess.id, path=self.path)
+        cookie.add(req, self.cookiename, sess.id,
+                   path=self.path,
+                   expires=cookie.cdate(time.time() + sess.expire))
 
     def fetch(self, req):
         now = int(time.time())