[Zope-Checkins] CVS: Zope2 - http_date.py:1.9

andreas@serenade.digicool.com andreas@serenade.digicool.com
Tue, 1 May 2001 08:10:45 -0400


Update of /cvs-repository/Zope2/ZServer/medusa
In directory serenade.digicool.com:/tmp/cvs-serv12527

Modified Files:
	http_date.py 
Log Message:
backport of former medusa patches



--- Updated File http_date.py in package Zope2 --
--- http_date.py	2001/05/01 11:44:48	1.8
+++ http_date.py	2001/05/01 12:10:44	1.9
@@ -104,9 +104,17 @@
     # parsdate.parsedate	- ~700/sec.
     # parse_http_date    	- ~1333/sec.
     
+weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
+monthname = [None, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+             'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
+
 def build_http_date (when):
-    return time.strftime ('%a, %d %b %Y %H:%M:%S GMT', time.gmtime(when))
-    
+    year, month, day, hh, mm, ss, wd, y, z = time.gmtime(when)
+    return "%s, %02d %3s %4d %02d:%02d:%02d GMT" % (
+            weekdayname[wd],
+            day, monthname[month], year,
+            hh, mm, ss)
+
 def parse_http_date (d):
     d = string.lower (d)
     tz = time.timezone