Author: damoxc

Revision: 5717

Log:
        change UTC to GMT and add a method for generating the expires int and 
string

Diff:
Modified: trunk/deluge/ui/web/auth.py
===================================================================
--- trunk/deluge/ui/web/auth.py 2009-09-07 20:47:51 UTC (rev 5716)
+++ trunk/deluge/ui/web/auth.py 2009-09-08 09:55:19 UTC (rev 5717)
@@ -81,6 +81,12 @@
         log.exception(e)
         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))
+    return expires, expires_str
+
 class Auth(JSONComponent):
     """
     The component that implements authentification into the JSON interface.
@@ -124,10 +130,7 @@
 
         config = component.get("DelugeWeb").config
         
-        expires = int(time.time()) + config["session_timeout"]
-        expires_str = time.strftime('%a, %d %b %Y %H:%M:%S UTC',
-                time.gmtime(expires))
-
+        expires, expires_str = make_expires(config["session_timeout"])
         checksum = str(make_checksum(session_id))
         
         request.addCookie('_session_id', session_id + checksum,
@@ -223,9 +226,7 @@
         else:
             session = config["sessions"][session_id]
             auth_level = session["level"]
-            expires = int(time.time()) + config["session_timeout"]
-            expires_str = time.strftime('%a, %d %b %Y %H:%M:%S UTC',
-                    time.gmtime(expires))
+            expires, expires_str = make_expires(config["session_timeout"])
             session["expires"] = expires
 
             _session_id = request.getCookie("_session_id")



--~--~---------~--~----~------------~-------~--~----~
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