[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher - BaseRequest.py:1.6 IApplicationRequest.py:1.4 IPublicationRequest.py:1.4

Jim Fulton jim@zope.com
Mon, 15 Jul 2002 18:01:12 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/Publisher
In directory cvs.zope.org:/tmp/cvs-serv3603/lib/python/Zope/Publisher

Modified Files:
	BaseRequest.py IApplicationRequest.py IPublicationRequest.py 
Log Message:
Added logic to the ZopePublication object to handle placeful
authentication services.

Fixed some bugs in the service manager and made the mapping
implementation there handle only local services.

Refactored the tests in ZopePublication to push some of the
browser-specific tests down to the Browser package.



=== Zope3/lib/python/Zope/Publisher/BaseRequest.py 1.5 => 1.6 ===
 from IPublisherRequest import IPublisherRequest
 from IPublicationRequest import IPublicationRequest
 from RequestDataProperty import RequestDataProperty, RequestDataMapper
+from cStringIO import StringIO 
 
 class IRequest(IPublisherRequest, IPublicationRequest, IApplicationRequest):
     """The basic request contract
@@ -58,7 +59,8 @@
         '_body_instream',    # input stream
         '_body',             # The request body as a string
         '_publication',      # publication object
-        '_presentation_skin',         # View skin
+        '_presentation_skin', # View skin
+        'user'               # request user, set by publication
         )
 
     environment = RequestDataProperty(RequestEnvironment)
@@ -76,6 +78,7 @@
             self._response = response
         self._body_instream = body_instream
         self._held = ()
+        self.user = None
 
 
     ############################################################
@@ -296,7 +299,20 @@
 
 
 
+class TestRequest(BaseRequest):
 
+    __slots__ = ('_presentation_type', )
+
+    def __init__(self, path, body_instream=None, outstream=None, environ=None):
+        if environ is None:
+            environ = {}
+        environ['PATH_INFO'] = path
+        if body_instream is None:
+            body_instream = StringIO('')
+        if outstream is None:
+            outstream = StringIO()
+
+        super(TestRequest, self).__init__(body_instream, outstream, environ)
 
 
 


=== Zope3/lib/python/Zope/Publisher/IApplicationRequest.py 1.3 => 1.4 ===
     """Features that support application logic
     """
 
+    user = Attribute("""User object associated with the request
+                        This is a read-only attribute.
+                        """)
+
     body = Attribute("""the body of the request as a string""")
         
     bodyFile = Attribute("""the body of the request as a file""")


=== Zope3/lib/python/Zope/Publisher/IPublicationRequest.py 1.3 => 1.4 ===
     """Interface provided by requests to IPublication objects
     """
 
+    user = Attribute("""User object associated with the request
+
+                        It is up to the publication object to set this
+                        attribute.
+                        """)
+
     response = Attribute("""the request's response object
 
         Return an IPublisherResponse for the request.