Changeset 1609
- Timestamp:
- 02/01/07 13:09:12
- Files:
-
- trunk/cherrypy/_cprequest.py (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/_cprequest.py
r1604 r1609 1 """CherryPy core request/response handling."""2 1 3 2 import Cookie … … 391 390 } 392 391 namespaces__doc = """ 393 A dict of config namespace names and handlers. Each config entry must392 A dict of config namespace names and handlers. Each config entry should 394 393 begin with a namespace name; the corresponding namespace handler will 395 394 be called once for each config entry in that namespace, and will be … … 428 427 429 428 def close(self): 429 """Run cleanup code and remove self from globals. (Core)""" 430 430 if not self.closed: 431 431 self.closed = True 432 432 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 pass439 440 cherrypy._serving.__dict__.clear()441 433 442 434 def run(self, method, path, query_string, req_protocol, headers, rfile): 443 """Process the Request. 435 """Process the Request. (Core) 444 436 445 437 method, path, query_string, and req_protocol should be pulled directly … … 530 522 531 523 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)""" 533 525 try: 534 526 try: … … 537 529 raise cherrypy.NotFound() 538 530 539 # Get the 'Host' header, so we can do HTTPRedirectsproperly.531 # Get the 'Host' header, so we can HTTPRedirect properly. 540 532 self.process_headers() 541 533 … … 544 536 self.toolmaps = {} 545 537 self.get_resource(path_info) 546 cherrypy._cpconfig._call_namespaces(self.config, self.namespaces) 538 cherrypy._cpconfig._call_namespaces(self.config, 539 self.namespaces) 547 540 548 541 self.hooks.run('on_start_resource') … … 553 546 554 547 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) 557 551 if mbs > 0: 558 552 self.rfile = http.SizeCheckWrapper(self.rfile, mbs) … … 581 575 582 576 def process_headers(self): 577 """Parse HTTP header data into Python structures. (Core)""" 583 578 self.params = http.parse_query_string(self.query_string) 584 579 … … 617 612 618 613 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)""" 620 615 dispatch = self.dispatch 621 616 # First, see if there is a custom dispatch at this URI. Custom … … 643 638 644 639 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)""" 646 641 # FieldStorage only recognizes POST, so fake it. 647 642 methenv = {'REQUEST_METHOD': "POST"} … … 666 661 667 662 def handle_error(self, exc): 663 """Handle the last exception. (Core)""" 668 664 try: 669 665 self.hooks.run("before_error_response") … … 678 674 679 675 def 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)""" 681 677 chunk = input.read(chunkSize) 682 678 while chunk: … … 784 780 785 781 def finalize(self): 786 """Transform headers (and cookies) into self.header_list. """782 """Transform headers (and cookies) into self.header_list. (Core)""" 787 783 try: 788 784 code, reason, _ = http.valid_status(self.status)

