Commits

Walt Woods committed 991ad90

request.segments is only available through a SegmentHandler now

  • Participants
  • Parent commits de8495a

Comments (0)

Files changed (2)

File cherrypy/__init__.py

     object initialized with the kwarg myDbName='myDb'.  Then the cherrypy
     default dispatcher would look for the property arg.klar in that 
     DatabaseHandler object to handle the request.  Additionally, the parameter
-    request.segments['myDbName'] would be set to 'myDb'.
+    request.segments['myDbName'] would be set to 'myDb' (request.segments
+    will exist only if the handler is accessed through a SegmentHandler).
 
     Note that if vpath elements end up in a path that does not exist, 
     SegmentHandler will still create the handler, but will not pass those kwargs
 
     def _cp_dispatch(self, vpath):
         parms = {}
+        serving.request.segments = getattr(serving.request, 'segments', {})
         for arg in self._args:
             if len(vpath) == 0:
                 break

File cherrypy/_cprequest.py

     before the 'on_start_resource' hook, and POST params are added
     between the 'before_request_body' and 'before_handler' hooks."""
 
-    segments = {}
-    """
-    A dict which contains any segment values popped off by 
-    cherrypy.SegmentHandler."""
-    
     # Message attributes
     header_list = []
     """
             path = path or "/"
             self.query_string = query_string or ''
             self.params = {}
-            self.segments = {}
             
             # Compare request and server HTTP protocol versions, in case our
             # server does not support the requested protocol. Limit our output