Author: damoxc

Revision: 5992

Log:
        Apply cookie date fix from adios

Diff:
Modified: branches/1.2_RC/ChangeLog
===================================================================
--- branches/1.2_RC/ChangeLog   2009-12-08 11:24:56 UTC (rev 5991)
+++ branches/1.2_RC/ChangeLog   2009-12-09 13:13:04 UTC (rev 5992)
@@ -3,6 +3,7 @@
        * Swap order of buttons in Remove window (Closes #1083)
        * Change the compressed js script to deluge-all.js to avoid naming 
          conflicts on case-sensitive filesystems.
+       * Apply patch from adios fixing the cookie date
 
 ==== GtkUI ====
        * Attempt to register as the default magnet uri handler in GNOME on 
startup

Modified: branches/1.2_RC/deluge/ui/web/auth.py
===================================================================
--- branches/1.2_RC/deluge/ui/web/auth.py       2009-12-08 11:24:56 UTC (rev 
5991)
+++ branches/1.2_RC/deluge/ui/web/auth.py       2009-12-09 13:13:04 UTC (rev 
5992)
@@ -51,6 +51,8 @@
 import random
 import hashlib
 import logging
+from datetime import datetime, timedelta
+from email.utils import formatdate
 
 from twisted.internet.defer import Deferred
 from twisted.internet.task import LoopingCall
@@ -82,9 +84,9 @@
         return None
 
 def make_expires(timeout):
-    expires = int(time.time()) + timeout
-    expires_str = time.strftime('%a, %d %b %Y %H:%M:%S GMT',
-            time.gmtime(expires))
+    dt = timedelta(seconds=timeout)
+    expires = time.mktime((datetime.now() + dt).timetuple())
+    expires_str = formatdate(timeval=expires, localtime=False, usegmt=True)
     return expires, expires_str
 
 class Auth(JSONComponent):

Modified: trunk/deluge/ui/web/auth.py
===================================================================
--- trunk/deluge/ui/web/auth.py 2009-12-08 11:24:56 UTC (rev 5991)
+++ trunk/deluge/ui/web/auth.py 2009-12-09 13:13:04 UTC (rev 5992)
@@ -51,6 +51,8 @@
 import random
 import hashlib
 import logging
+from datetime import datetime, timedelta
+from email.utils import formatdate
 
 from twisted.internet.defer import Deferred
 from twisted.internet.task import LoopingCall
@@ -82,9 +84,9 @@
         return None
 
 def make_expires(timeout):
-    expires = int(time.time()) + timeout
-    expires_str = time.strftime('%a, %d %b %Y %H:%M:%S GMT',
-            time.gmtime(expires))
+    dt = timedelta(seconds=timeout)
+    expires = time.mktime((datetime.now() + dt).timetuple())
+    expires_str = formatdate(timeval=expires, localtime=False, usegmt=True)
     return expires, expires_str
 
 class Auth(JSONComponent):


--

You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.


Reply via email to