Robert Brewer avatar Robert Brewer committed d5b41d5

Bah. Forgot a file.

Comments (0)

Files changed (1)

cherrypy/_cprequest.py

-"""CherryPy core request/response handling."""
 
 import Cookie
 import os
                   # "tools": See _cptools.Toolbox
                   }
     namespaces__doc = """
-    A dict of config namespace names and handlers. Each config entry must
+    A dict of config namespace names and handlers. Each config entry should
     begin with a namespace name; the corresponding namespace handler will
     be called once for each config entry in that namespace, and will be
     passed two arguments: the config key (with the namespace removed)
         self.namespaces = self.namespaces.copy()
     
     def close(self):
+        """Run cleanup code and remove self from globals. (Core)"""
         if not self.closed:
             self.closed = True
             self.hooks.run('on_end_request')
-            
-            s = (self, cherrypy._serving.response)
-            try:
-                cherrypy.engine.servings.remove(s)
-            except ValueError:
-                pass
-            
-            cherrypy._serving.__dict__.clear()
     
     def run(self, method, path, query_string, req_protocol, headers, rfile):
-        """Process the Request.
+        """Process the Request. (Core)
         
         method, path, query_string, and req_protocol should be pulled directly
             from the Request-Line (e.g. "GET /path?key=val HTTP/1.0").
         return cherrypy.response
     
     def respond(self, path_info):
-        """Generate a response for the resource at self.path_info."""
+        """Generate a response for the resource at self.path_info. (Core)"""
         try:
             try:
                 try:
                     if self.app is None:
                         raise cherrypy.NotFound()
                     
-                    # Get the 'Host' header, so we can do HTTPRedirects properly.
+                    # Get the 'Host' header, so we can HTTPRedirect properly.
                     self.process_headers()
                     
                     # Make a copy of the class hooks
                     self.hooks = self.__class__.hooks.copy()
                     self.toolmaps = {}
                     self.get_resource(path_info)
-                    cherrypy._cpconfig._call_namespaces(self.config, self.namespaces)
+                    cherrypy._cpconfig._call_namespaces(self.config,
+                                                        self.namespaces)
                     
                     self.hooks.run('on_start_resource')
                     
                             self.process_request_body = False
                         
                         if self.process_request_body:
-                            # Prepare the SizeCheckWrapper for the request body
-                            mbs = cherrypy.server.max_request_body_size
+                            # Prepare the SizeCheckWrapper for the req body
+                            mbs = getattr(cherrypy.server,
+                                          "max_request_body_size", 0)
                             if mbs > 0:
                                 self.rfile = http.SizeCheckWrapper(self.rfile, mbs)
                     
             self.handle_error(sys.exc_info())
     
     def process_headers(self):
+        """Parse HTTP header data into Python structures. (Core)"""
         self.params = http.parse_query_string(self.query_string)
         
         # Process the headers into self.headers
         self.base = "%s://%s" % (self.scheme, host)
     
     def get_resource(self, path):
-        """Find and call a dispatcher (which sets self.handler and .config)."""
+        """Call a dispatcher (which sets self.handler and .config). (Core)"""
         dispatch = self.dispatch
         # First, see if there is a custom dispatch at this URI. Custom
         # dispatchers can only be specified in app.config, not in _cp_config
         dispatch(path)
     
     def process_body(self):
-        """Convert request.rfile into request.params (or request.body)."""
+        """Convert request.rfile into request.params (or request.body). (Core)"""
         # FieldStorage only recognizes POST, so fake it.
         methenv = {'REQUEST_METHOD': "POST"}
         try:
             self.params.update(http.params_from_CGI_form(forms))
     
     def handle_error(self, exc):
+        """Handle the last exception. (Core)"""
         try:
             self.hooks.run("before_error_response")
             if self.error_response:
 
 
 def file_generator(input, chunkSize=65536):
-    """Yield the given input (a file object) in chunks (default 64k)."""
+    """Yield the given input (a file object) in chunks (default 64k). (Core)"""
     chunk = input.read(chunkSize)
     while chunk:
         yield chunk
         return newbody
     
     def finalize(self):
-        """Transform headers (and cookies) into self.header_list."""
+        """Transform headers (and cookies) into self.header_list. (Core)"""
         try:
             code, reason, _ = http.valid_status(self.status)
         except ValueError, x:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.