datetime switch bug fixed in ustrftime tls-sprint
authorFlorent <florent@secondweb.fr>
Fri, 17 Apr 2009 08:52:05 +0200
branchtls-sprint
changeset 1387 4af48b1aaf29
parent 1386 8ba1f0d36c7e
child 1388 6d5f0ccf31b8
datetime switch bug fixed in ustrftime
utils.py
--- a/utils.py	Fri Apr 17 08:51:16 2009 +0200
+++ b/utils.py	Fri Apr 17 08:52:05 2009 +0200
@@ -9,7 +9,7 @@
 import locale
 from md5 import md5
 from datetime import datetime, timedelta, date
-from time import time
+from time import time, strftime
 from random import randint, seed
     
 # initialize random seed from current time
@@ -53,7 +53,7 @@
     """
     # date format may depend on the locale
     encoding = locale.getpreferredencoding(do_setlocale=False) or 'UTF-8'
-    return unicode(date.strftime(str(fmt)), encoding)
+    return unicode(strftime(str(fmt), date.timetuple()), encoding)
 
 def make_uid(key):
     """forge a unique identifier"""