localtime instead of GMT

Mikael Nilsson mikael at nilsson.name
Wed Oct 10 02:27:41 EST 2007


I propose the following mod to __init__.py:


It makes all keys of type DATE be presented in localtime and not GMT.

Please also not the two related bugs in feedparser I had to fix to get localtime working..

http://code.google.com/p/feedparser/issues/detail?id=14
http://code.google.com/p/feedparser/issues/detail?id=70

@@ -90,7 +90,8 @@
     for key in item.keys():
         if item.key_type(key) == item.DATE:
             date = item.get_as_date(key)
-            info[key] = time.strftime(date_format, date)
+            info[key] = time.strftime(date_format, time.localtime(calendar.timegm(date)))
             info[key + "_iso"] = time.strftime(TIMEFMT_ISO, date)
             info[key + "_822"] = time.strftime(TIMEFMT_822, date)
         else:
/Mikael

-- 
<mikael at nilsson.name>

Plus ça change, plus c'est la même chose
	



More information about the devel mailing list