[Zope3-checkins] CVS: Zope3/src/zope/publisher - http.py:1.53 xmlrpc.py:1.12 browser.py:1.31 base.py:1.19

Philipp von Weitershausen philikon at philikon.de
Thu May 6 06:12:14 EDT 2004


Update of /cvs-repository/Zope3/src/zope/publisher
In directory cvs.zope.org:/tmp/cvs-serv6784/src/zope/publisher

Modified Files:
	http.py xmlrpc.py browser.py base.py 
Log Message:
Cleanups:
- booleans
- docstrings
- whitespace, indentation


=== Zope3/src/zope/publisher/http.py 1.52 => 1.53 ===
--- Zope3/src/zope/publisher/http.py:1.52	Tue Apr 13 05:57:04 2004
+++ Zope3/src/zope/publisher/http.py	Thu May  6 06:12:13 2004
@@ -15,7 +15,6 @@
 
 $Id$
 """
-
 import re, time, random
 from urllib import quote, unquote, splitport
 from types import StringTypes, ClassType
@@ -36,8 +35,8 @@
 from zope.i18n.locales import locales, LoadLocaleError
 
 from zope.publisher.base import BaseRequest, BaseResponse
-from zope.publisher.base \
-     import RequestDataProperty, RequestDataMapper, RequestDataGetter
+from zope.publisher.base import RequestDataProperty, RequestDataMapper
+from zope.publisher.base import RequestDataGetter
 
 
 # Default Encoding
@@ -166,8 +165,7 @@
 STAGGER_RETRIES = True
 
 class HTTPRequest(BaseRequest):
-    """
-    Model HTTP request data.
+    """Model HTTP request data.
 
     This object provides access to request data.  This includes, the
     input headers, form data, server data, and cookies.
@@ -211,7 +209,6 @@
     values will be looked up in the order: environment variables,
     other variables, form data, and then cookies.
     """
-
     implements(IHTTPCredentials, IHTTPRequest, IHTTPApplicationRequest)
 
     __slots__ = (
@@ -277,13 +274,10 @@
     locale = property(_getLocale)
 
     def __setupURLBase(self):
-
         get_env = self._environ.get
-
-        ################################################################
         # Get base info first. This isn't likely to cause
         # errors and might be useful to error handlers.
-        script = get_env('SCRIPT_NAME','').strip()
+        script = get_env('SCRIPT_NAME', '').strip()
 
         # _script and the other _names are meant for URL construction
         self._app_names = filter(None, script.split('/'))
@@ -298,7 +292,6 @@
         if server_url.endswith('/'):
             server_url = server_url[:-1]
 
-
         # strip off leading /'s of script
         while script.startswith('/'):
             script = script[1:]
@@ -362,8 +355,6 @@
         return result
 
     def __setupCookies(self):
-
-        ################################################################
         # Cookie values should *not* be appended to existing form
         # vars with the same name - they are more like default values
         # for names not otherwise specified in the form.
@@ -471,9 +462,6 @@
             message = logging_info.getLogMessage()
             self.response.http_transaction.setAuthUserName(message)
 
-    #
-    ############################################################
-
     def _createResponse(self, outstream):
         # Should be overridden by subclasses
         return HTTPResponse(outstream)
@@ -508,7 +496,7 @@
             names = self._app_names
 
         # See: http://www.ietf.org/rfc/rfc2718.txt, Section 2.2.5
-        names =  [quote(name.encode("utf-8"), safe='/+@') for name in names]
+        names = [quote(name.encode("utf-8"), safe='/+@') for name in names]
 
         if path_only:
             return names and ('/' + '/'.join(names)) or '/'
@@ -528,7 +516,6 @@
 
         A Value error is raise if the shift can't be performed.
         """
-
         if len(self._traversed_names) == 1:
             self._app_names.append(self._traversed_names.pop())
             return
@@ -571,7 +558,6 @@
 
 
 class HTTPResponse(BaseResponse):
-
     implements(IHTTPResponse, IHTTPApplicationResponse)
 
     __slots__ = (
@@ -968,9 +954,7 @@
 
 
     def outputBody(self):
-        """
-        Outputs the response body.
-        """
+        """Outputs the response body."""
         self.output(self._body)
 
 
@@ -983,7 +967,6 @@
 
 
 class DefaultPublisher:
-
     implements(IHTTPPublisher)
 
     def publishTraverse(self, request, name):
@@ -1000,7 +983,6 @@
 
 
 class HTTPCharsets:
-
     implements(IUserPreferredCharsets)
 
     def __init__(self, request):


=== Zope3/src/zope/publisher/xmlrpc.py 1.11 => 1.12 ===
--- Zope3/src/zope/publisher/xmlrpc.py:1.11	Fri Mar 19 15:26:43 2004
+++ Zope3/src/zope/publisher/xmlrpc.py	Thu May  6 06:12:13 2004
@@ -43,7 +43,6 @@
 
 
 class XMLRPCRequest(HTTPRequest):
-
     implements(IXMLRPCRequest)
 
     _args = ()


=== Zope3/src/zope/publisher/browser.py 1.30 => 1.31 ===
--- Zope3/src/zope/publisher/browser.py:1.30	Mon Apr 12 09:51:39 2004
+++ Zope3/src/zope/publisher/browser.py	Thu May  6 06:12:13 2004
@@ -200,7 +200,6 @@
 
 
 class BrowserRequest(HTTPRequest):
-
     implements(IBrowserRequest, IBrowserApplicationRequest)
 
     __slots__ = (
@@ -211,9 +210,9 @@
         '__defaults',
         )
 
-    use_redirect = 0 # Set this to 1 in a subclass to redirect GET
-                     # requests when the effective and actual URLs differ.
-
+    # Set this to True in a subclass to redirect GET requests when the
+    # effective and actual URLs differ.
+    use_redirect = False 
 
     def __init__(self, body_instream, outstream, environ, response=None):
         self.form = {}
@@ -590,7 +589,7 @@
     """Browser requests that redirect when the actual and effective URLs differ
     """
 
-    use_redirect = 1
+    use_redirect = True
 
 class TestRequest(BrowserRequest):
     """Browser request with a constructor convenient for testing


=== Zope3/src/zope/publisher/base.py 1.18 => 1.19 ===
--- Zope3/src/zope/publisher/base.py:1.18	Sat May  1 10:37:18 2004
+++ Zope3/src/zope/publisher/base.py	Thu May  6 06:12:13 2004
@@ -424,11 +424,16 @@
         super(TestRequest, self).__init__(body_instream, outstream, environ)
 
 
-class DefaultPublication:
+class DefaultPublication(object):
+    """A stub publication.
 
+    This works just like Zope2's ZPublisher. It rejects any name
+    starting with an underscore and any objects (specifically: method)
+    that doesn't have a docstring.
+    """
     implements(IPublication)
 
-    require_docstrings = 1
+    require_docstrings = True
 
     def __init__(self, app):
         self.app = app




More information about the Zope3-Checkins mailing list