[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher/Browser - IBrowserApplicationRequest.py:1.1.2.1.2.1

Jim Fulton jim@zope.com
Mon, 25 Mar 2002 14:12:04 -0500


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

Modified Files:
      Tag: Zope3-publisher-refactor-branch
	IBrowserApplicationRequest.py 
Log Message:
Added an attribute to get at form data.

Also added a more specific (than IEnumerableMapping) __getitem__
method that says where the data comes from.


=== Zope3/lib/python/Zope/Publisher/Browser/IBrowserApplicationRequest.py 1.1.2.1 => 1.1.2.1.2.1 ===
 """
 
-from Zope.Publisher.IApplicationRequest import IApplicationRequest
+from Zope.Publisher.HTTP.IHTTPApplicationRequest import IHTTPApplicationRequest
+from Interface.Attribute import Attribute
 
-class IHTTPApplicationRequest(IApplicationRequest):
-    """HTTP request data.
-    
-    This object provides access to request data.  This includes, the
-    input headers, form data, server data, and cookies.
+class IHTTPApplicationRequest(IHTTPApplicationRequest):
+    """Browser-specific requests
+    """
 
-    Request objects are created by the object publisher and will be
-    passed to published objects through the argument name, REQUEST.
+    def __getitem__(key):
+        """Return Browser request data 
 
-    The request object is a mapping object that represents a
-    collection of variable to value mappings.  In addition, variables
-    are divided into four categories:
+        Request data sre retrieved from one of:
 
-      - Environment variables
+        - Environment variables
 
-        These variables include input headers, server data, and other
-        request-related data.  The variable names are as <a
-        href="http://hoohoo.ncsa.uiuc.edu/cgi/env.html">specified</a>
-        in the <a
-        href="http://hoohoo.ncsa.uiuc.edu/cgi/interface.html">CGI
-        specification</a>
+          These variables include input headers, server data, and other
+          request-related data.  The variable names are as <a
+          href="http://hoohoo.ncsa.uiuc.edu/cgi/env.html">specified</a>
+          in the <a
+          href="http://hoohoo.ncsa.uiuc.edu/cgi/interface.html">CGI
+          specification</a>
 
-      - Cookies
+        - Cookies
 
-        These are the cookie data, if present.
+          These are the cookie data, if present.
 
-      - Other
+        - Form data
 
-        Data that may be set by an application object.
+        Form data are searched before cookies, which are searched
+        before environmental data.
+        """
 
-    The form data of a request is actually a Field Storage
-    object.  When file uploads are used, this provides a richer and
-    more complex interface than is provided by accessing form data as
-    items of the request.  See the FieldStorage class documentation
-    for more details.
+    form = Attribute(
+        """Form data
 
-    The request object may be used as a mapping object, in which case
-    values will be looked up in the order: environment variables,
-    other variables, and then cookies.    
-    """
+        This is a read-only mapping from name to form value for the name.
+        """)