[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher/HTTP - BrowserPayload.py:1.1.2.3 HTTPRequest.py:1.1.2.7 HTTPResponse.py:1.1.2.5 IPayload.py:1.1.2.2
Shane Hathaway
shane@digicool.com
Mon, 19 Nov 2001 15:25:31 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/Publisher/HTTP
In directory cvs.zope.org:/tmp/cvs-serv21252/lib/python/Zope/Publisher/HTTP
Modified Files:
Tag: Zope-3x-branch
BrowserPayload.py HTTPRequest.py HTTPResponse.py IPayload.py
Log Message:
Reoriented payload objects. They now return the publication object.
Also made Publish.py easier to understand.
=== Zope3/lib/python/Zope/Publisher/HTTP/BrowserPayload.py 1.1.2.2 => 1.1.2.3 ===
__implements__ = IRequestPayload
+ def __init__(self, publication):
+ self.publication = publication
+
def getPreferredPublishingType(self):
#return IBrowserPublish
return None
@@ -369,6 +372,8 @@
other.update(form)
if meth:
request.setRequestDefault(meth)
+
+ return self.publication
def debugInfo(self, request):
=== Zope3/lib/python/Zope/Publisher/HTTP/HTTPRequest.py 1.1.2.6 => 1.1.2.7 ===
from Zope.Publisher.BaseRequest import BaseRequest
from HTTPResponse import HTTPResponse
-from BrowserPayload import BrowserRequestPayload
from cgi_names import isCGI_NAME, hide_key
from urllib import quote, unquote, splittype, splitport
@@ -72,7 +71,7 @@
# payload is a protocol-specific handler for the body of
# the request.
- payload = BrowserRequestPayload()
+ payload = None
SERVER_URL = '' # The SERVER_URL header
@@ -88,10 +87,12 @@
def retry(self):
self.retry_count=self.retry_count+1
self.full_instream.seek(0)
- r=self.__class__(full_instream=self.full_instream,
- environ=self._orig_env,
- response=self.response.retry()
- )
+ r=self.__class__(
+ payload=self._orig_payload,
+ full_instream=self.full_instream,
+ environ=self._orig_env,
+ response=self.response.retry()
+ )
r.retry_count=self.retry_count
return r
@@ -212,8 +213,10 @@
return self.SERVER_URL
- def __init__(self, full_instream, environ, response):
+ def __init__(self, payload, full_instream, environ, response):
BaseRequest.__init__(self, response)
+ self.payload = payload
+ self._orig_payload = payload
self.full_instream = full_instream
self._orig_env = environ
environ = sane_environment(environ)
@@ -246,9 +249,10 @@
self.SERVER_URL = server_url = server_url.strip()
else:
server_url = self._deduceServerURL()
-
- if server_url[-1:]=='/': server_url=server_url[:-1]
-
+
+ if server_url[-1:] == '/':
+ server_url = server_url[:-1]
+
if b: self.base="%s/%s" % (server_url,b)
else: self.base=server_url
while script[:1]=='/': script=script[1:]
@@ -270,9 +274,7 @@
self.cookies=cookies
def processInputs(self):
- payload = self.payload
- self.ptype = payload.getPreferredPublishingType()
- payload.processInputs(self)
+ return self.payload.processInputs(self)
def get_header(self, name, default=None):
"""Return the named HTTP header, or an optional default
=== Zope3/lib/python/Zope/Publisher/HTTP/HTTPResponse.py 1.1.2.4 => 1.1.2.5 ===
from Zope.Publisher.BaseResponse import BaseResponse
from Zope.Publisher.Exceptions import Redirect
-from BrowserPayload import BrowserResponsePayload
nl2sp = string.maketrans('\n',' ')
@@ -109,18 +108,20 @@
base = None
realm = 'Zope'
_error_format = 'text/html'
- payload = BrowserResponsePayload()
+ payload = None
- def __init__(self, outstream, body='', headers=None,
+ def __init__(self, payload, outstream, body='', headers=None,
status=None, cookies=None):
+ self.payload = payload
+ self._orig_payload = payload
BaseResponse.__init__(self, outstream, body, headers, status, cookies)
def retry(self):
"""
Returns a response object to be used in a retry attempt
"""
- return self.__class__(self.outstream)
-
+ return self.__class__(self._orig_payload, self.outstream)
+
def setStatus(self, status, reason=None):
'''
Sets the HTTP status code of the response; the argument may
=== Zope3/lib/python/Zope/Publisher/HTTP/IPayload.py 1.1.2.1 => 1.1.2.2 ===
def processInputs(request):
"""
- Processes request inputs.
+ Processes request inputs, returning a Publication object.
"""
- def getPreferredPublishingType():
+ def debugInfo(request):
"""
- Returns an interface object.
+ Returns text containing debugging information.
"""