summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2014-06-09 15:54:42 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2014-06-09 15:54:42 +0200
commit35c6c6424faf17e8f4d09d50cfb5333deb007cc1 (patch)
tree715404a23f270e776b7a2123decacb9d72047d22
parentfixed jshint (diff)
downloadpyload-35c6c6424faf17e8f4d09d50cfb5333deb007cc1.tar.xz
patching _getdate method
-rw-r--r--pyload/network/CookieJar.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/pyload/network/CookieJar.py b/pyload/network/CookieJar.py
index 42ccdcafc..39f416a38 100644
--- a/pyload/network/CookieJar.py
+++ b/pyload/network/CookieJar.py
@@ -1,10 +1,18 @@
# -*- coding: utf-8 -*-
+from datetime import datetime, timedelta
from time import time
-from Cookie import SimpleCookie
+import Cookie
-class CookieJar(SimpleCookie):
+# monkey patch for 32 bit systems
+def _getdate(future=0, weekdayname=Cookie._weekdayname, monthname=Cookie._monthname):
+ dt = datetime.now() + timedelta(seconds=int(future))
+ return "%s, %02d %3s %4d %02d:%02d:%02d GMT" % \
+ (weekdayname[dt.weekday()], dt.day, monthname[dt.month], dt.year, dt.hour, dt.minute, dt.second)
+Cookie._getdate = _getdate
+
+class CookieJar(Cookie.SimpleCookie):
def getCookie(self, name):
return self[name].value
@@ -12,18 +20,17 @@ class CookieJar(SimpleCookie):
self[name] = value
self[name]["domain"] = domain
self[name]["path"] = path
-
- #Value of expires should be integer if possible
+
+ # Value of expires should be integer if possible
# otherwise the cookie won't be used
- expire=0
if not exp:
- expires = time() + 3600 * 24 * 180
+ expires = time() + 3600 * 24 * 180
else:
try:
expires = int(exp)
except ValueError:
expires = exp
-
+
self[name]["expires"] = expires
if secure == "TRUE":
self[name]["secure"] = secure