Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1609

Show
Ignore:
Timestamp:
02/01/07 13:09:12
Author:
fumanchu
Message:

Bah. Forgot a file.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/_cprequest.py

    r1604 r1609  
    1 """CherryPy core request/response handling.""" 
    21 
    32import Cookie 
     
    391390                  } 
    392391    namespaces__doc = """ 
    393     A dict of config namespace names and handlers. Each config entry must 
     392    A dict of config namespace names and handlers. Each config entry should 
    394393    begin with a namespace name; the corresponding namespace handler will 
    395394    be called once for each config entry in that namespace, and will be 
     
    428427     
    429428    def close(self): 
     429        """Run cleanup code and remove self from globals. (Core)""" 
    430430        if not self.closed: 
    431431            self.closed = True 
    432432            self.hooks.run('on_end_request') 
    433              
    434             s = (self, cherrypy._serving.response) 
    435             try: 
    436                 cherrypy.engine.servings.remove(s) 
    437             except ValueError: 
    438                 pass 
    439              
    440             cherrypy._serving.__dict__.clear() 
    441433     
    442434    def run(self, method, path, query_string, req_protocol, headers, rfile): 
    443         """Process the Request. 
     435        """Process the Request. (Core) 
    444436         
    445437        method, path, query_string, and req_protocol should be pulled directly 
     
    530522     
    531523    def respond(self, path_info): 
    532         """Generate a response for the resource at self.path_info.""" 
     524        """Generate a response for the resource at self.path_info. (Core)""" 
    533525        try: 
    534526            try: 
     
    537529                        raise cherrypy.NotFound() 
    538530                     
    539                     # Get the 'Host' header, so we can do HTTPRedirects properly. 
     531                    # Get the 'Host' header, so we can HTTPRedirect properly. 
    540532                    self.process_headers() 
    541533                     
     
    544536                    self.toolmaps = {} 
    545537                    self.get_resource(path_info) 
    546                     cherrypy._cpconfig._call_namespaces(self.config, self.namespaces) 
     538                    cherrypy._cpconfig._call_namespaces(self.config, 
     539                                                        self.namespaces) 
    547540                     
    548541                    self.hooks.run('on_start_resource') 
     
    553546                         
    554547                        if self.process_request_body: 
    555                             # Prepare the SizeCheckWrapper for the request body 
    556                             mbs = cherrypy.server.max_request_body_size 
     548                            # Prepare the SizeCheckWrapper for the req body 
     549                            mbs = getattr(cherrypy.server, 
     550                                          "max_request_body_size", 0) 
    557551                            if mbs > 0: 
    558552                                self.rfile = http.SizeCheckWrapper(self.rfile, mbs) 
     
    581575     
    582576    def process_headers(self): 
     577        """Parse HTTP header data into Python structures. (Core)""" 
    583578        self.params = http.parse_query_string(self.query_string) 
    584579         
     
    617612     
    618613    def get_resource(self, path): 
    619         """Find and call a dispatcher (which sets self.handler and .config).""" 
     614        """Call a dispatcher (which sets self.handler and .config). (Core)""" 
    620615        dispatch = self.dispatch 
    621616        # First, see if there is a custom dispatch at this URI. Custom 
     
    643638     
    644639    def process_body(self): 
    645         """Convert request.rfile into request.params (or request.body).""" 
     640        """Convert request.rfile into request.params (or request.body). (Core)""" 
    646641        # FieldStorage only recognizes POST, so fake it. 
    647642        methenv = {'REQUEST_METHOD': "POST"} 
     
    666661     
    667662    def handle_error(self, exc): 
     663        """Handle the last exception. (Core)""" 
    668664        try: 
    669665            self.hooks.run("before_error_response") 
     
    678674 
    679675def file_generator(input, chunkSize=65536): 
    680     """Yield the given input (a file object) in chunks (default 64k).""" 
     676    """Yield the given input (a file object) in chunks (default 64k). (Core)""" 
    681677    chunk = input.read(chunkSize) 
    682678    while chunk: 
     
    784780     
    785781    def finalize(self): 
    786         """Transform headers (and cookies) into self.header_list.""" 
     782        """Transform headers (and cookies) into self.header_list. (Core)""" 
    787783        try: 
    788784            code, reason, _ = http.valid_status(self.status) 

Hosted by WebFaction

Log in as guest/cpguest to create tickets