Commit d157aa80 authored by Hanno Schlichting's avatar Hanno Schlichting

Avoid dependency between WSGIPublisher and ZServer.

parent 0bd4df83
......@@ -22,7 +22,6 @@ from zExceptions import Unauthorized
from zope.event import notify
from zope.security.management import newInteraction, endInteraction
from zope.publisher.skinnable import setDefaultSkin
from ZServer.medusa.http_date import build_http_date
from ZPublisher.HTTPRequest import HTTPRequest
from ZPublisher.HTTPResponse import HTTPResponse
......@@ -35,6 +34,9 @@ from ZPublisher.Publish import missing_name
from ZPublisher.Iterators import IUnboundStreamIterator, IStreamIterator
_NOW = None # overwrite for testing
MONTHNAME = [None, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
WEEKDAYNAME = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
def _now():
......@@ -43,6 +45,12 @@ def _now():
return time.time()
def build_http_date(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)
class WSGIResponse(HTTPResponse):
"""A response object for WSGI
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment