Robert Brewer  committed d5b41d5

Bah. Forgot a file.

  • Participants
  • Parent commits 6a03f70
  • Branches default

Comments (0)

Files changed (1)

File cherrypy/

-"""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
-            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)"""
                     if is None:
                         raise cherrypy.NotFound()
-                    # Get the 'Host' header, so we can do HTTPRedirects properly.
+                    # Get the 'Host' header, so we can HTTPRedirect properly.
                     # Make a copy of the class hooks
                     self.hooks = self.__class__.hooks.copy()
                     self.toolmaps = {}
-                    cherrypy._cpconfig._call_namespaces(self.config, self.namespaces)
+                    cherrypy._cpconfig._call_namespaces(self.config,
+                                                        self.namespaces)
                             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)
     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
     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"}
     def handle_error(self, exc):
+        """Handle the last exception. (Core)"""
             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 =
     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)"""
             code, reason, _ = http.valid_status(self.status)
         except ValueError, x: