Changeset 886
- Timestamp:
- 12/28/05 05:33:09
- Files:
-
- trunk/cherrypy/_cphttptools.py (modified) (6 diffs)
- trunk/cherrypy/_cputil.py (modified) (1 diff)
- trunk/cherrypy/config.py (modified) (2 diffs)
- trunk/cherrypy/filters/sessionauthenticatefilter.py (modified) (4 diffs)
- trunk/cherrypy/filters/staticfilter.py (modified) (2 diffs)
- trunk/cherrypy/filters/virtualhostfilter.py (modified) (1 diff)
- trunk/cherrypy/filters/xmlrpcfilter.py (modified) (5 diffs)
- trunk/cherrypy/test/helper.py (modified) (1 diff)
- trunk/cherrypy/test/test_objectmapping.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/_cphttptools.py
r884 r886 27 27 self.remoteHost = remoteHost 28 28 self.scheme = scheme 29 self.execute Main = True29 self.execute_main = True 30 30 self.closed = False 31 31 … … 75 75 76 76 # This has to be done very early in the request process, 77 # because request.object Path is used for config lookups77 # because request.object_path is used for config lookups 78 78 # right away. 79 79 self.processRequestLine() … … 93 93 try: 94 94 applyFilters('before_main') 95 if self.execute Main:95 if self.execute_main: 96 96 self.main() 97 97 break 98 98 except cherrypy.InternalRedirect, ir: 99 self.object Path = ir.path99 self.object_path = ir.path 100 100 101 101 applyFilters('before_finalize') … … 138 138 self.protocol = proto 139 139 140 # Change object Path in filters to change140 # Change object_path in filters to change 141 141 # the object that will get rendered 142 self.object Path = path142 self.object_path = path 143 143 144 144 # Compare request and server HTTP versions, in case our server does … … 238 238 """Obtain and set cherrypy.response.body from a page handler.""" 239 239 if path is None: 240 path = self.object Path240 path = self.object_path 241 241 242 242 page_handler, object_path, virtual_path = self.mapPathToObject(path) … … 245 245 virtual_path = [x.replace("%2F", "/") for x in virtual_path] 246 246 247 # Remove "root" from object_path and join it to get object Path248 self.object Path = '/' + '/'.join(object_path[1:])247 # Remove "root" from object_path and join it to get object_path 248 self.object_path = '/' + '/'.join(object_path[1:]) 249 249 try: 250 250 body = page_handler(*virtual_path, **self.params) trunk/cherrypy/_cputil.py
r862 r886 18 18 if objectpath is None: 19 19 try: 20 objectpath = cherrypy.request.object Path20 objectpath = cherrypy.request.object_path 21 21 except AttributeError: 22 22 pass trunk/cherrypy/config.py
r877 r886 96 96 if path is None: 97 97 try: 98 path = cherrypy.request.object Path98 path = cherrypy.request.object_path 99 99 except AttributeError: 100 # There's no request.object Path yet, so use the global settings.100 # There's no request.object_path yet, so use the global settings. 101 101 path = "global" 102 102 … … 158 158 159 159 try: 160 path = cherrypy.request.object Path160 path = cherrypy.request.object_path 161 161 except AttributeError: 162 162 return results trunk/cherrypy/filters/sessionauthenticatefilter.py
r869 r886 27 27 28 28 def before_main(self): 29 cherrypy.request.user = None 30 cherrypy.thread_data.user = None 31 29 32 conf = cherrypy.config.get 30 33 if ((not conf('session_authenticate_filter.on', False)) … … 43 46 cherrypy.session[session_key] = None 44 47 cherrypy.request.user = None 48 cherrypy.thread_data.user = None 45 49 from_page = cherrypy.request.params.get('from_page', '..') 46 50 raise cherrypy.HTTPRedirect(from_page) … … 52 56 if error_msg: 53 57 cherrypy.response.body = login_screen(from_page, login = login, error_msg = error_msg) 54 cherrypy.request.execute Main = False58 cherrypy.request.execute_main = False 55 59 else: 56 60 cherrypy.session[session_key] = login … … 61 65 62 66 # Check if user is logged in 67 temp_user = None 63 68 if (not cherrypy.session.get(session_key)) and not_logged_in: 64 69 # Call not_logged_in so that applications where anynymous user 65 70 # is OK can handle it 66 not_logged_in()67 if not cherrypy.session.get(session_key):71 temp_user = not_logged_in() 72 if (not cherrypy.session.get(session_key)) and not temp_user: 68 73 cherrypy.response.body = login_screen(cherrypy.request.browser_url) 69 cherrypy.request.execute Main = False74 cherrypy.request.execute_main = False 70 75 return 71 76 72 77 # Everything is OK: user is logged in 73 if load_user_by_username :74 username = cherrypy.session[session_key]78 if load_user_by_username and not cherrypy.thread_data.user: 79 username = temp_user or cherrypy.session[session_key] 75 80 cherrypy.request.user = load_user_by_username(username) 76 81 cherrypy.thread_data.user = load_user_by_username(username) trunk/cherrypy/filters/staticfilter.py
r878 r886 16 16 17 17 request = cherrypy.request 18 path = request.object Path18 path = request.object_path 19 19 20 20 regex = config.get('static_filter.match', '') … … 44 44 try: 45 45 cptools.serveFile(filename) 46 request.execute Main = False46 request.execute_main = False 47 47 except cherrypy.NotFound: 48 48 # if we didn't find the static file, continue trunk/cherrypy/filters/virtualhostfilter.py
r883 r886 31 31 32 32 domain = cherrypy.request.headers.get('Host', '') 33 if cherrypy.config.get("virtual_host_filter.use XForwardedHost", True):33 if cherrypy.config.get("virtual_host_filter.use_x_forwarded_host", True): 34 34 domain = cherrypy.request.headers.get("X-Forwarded-Host", domain) 35 35 36 36 prefix = cherrypy.config.get("virtual_host_filter." + domain, "") 37 37 if prefix: 38 cherrypy.request.object Path = prefix + "/" + cherrypy.request.objectPath38 cherrypy.request.object_path = prefix + "/" + cherrypy.request.object_path 39 39 trunk/cherrypy/filters/xmlrpcfilter.py
r856 r886 96 96 Unmarshalls the posted data to a methodname and parameters. 97 97 - These are stored in cherrypy.request.rpcMethod and .rpcParams 98 - The method is also stored in cherrypy.request.object Path,98 - The method is also stored in cherrypy.request.object_path, 99 99 so CP2 will find the right method to call for you, 100 100 based on the root's position. … … 139 139 # - 'someurl' + method >> someurl.method 140 140 # - 'someurl/someother' + method >> someurl.someother.method 141 if not request.object Path.endswith('/'):142 request.object Path += '/'143 if request.object Path.startswith('/RPC2/'):141 if not request.object_path.endswith('/'): 142 request.object_path += '/' 143 if request.object_path.startswith('/RPC2/'): 144 144 # strip the first /rpc2 145 request.object Path = request.objectPath[5:]146 request.object Path += str(method).replace('.', '/')145 request.object_path = request.object_path[5:] 146 request.object_path += str(method).replace('.', '/') 147 147 request.paramList = list(params) 148 148 … … 159 159 return 160 160 161 path = cherrypy.request.object Path161 path = cherrypy.request.object_path 162 162 while True: 163 163 try: … … 167 167 virtual_path = [x.replace("%2F", "/") for x in virtual_path] 168 168 169 # Remove "root" from object_path and join it to get object Path170 self.object Path = '/' + '/'.join(object_path[1:])169 # Remove "root" from object_path and join it to get object_path 170 self.object_path = '/' + '/'.join(object_path[1:]) 171 171 args = virtual_path + cherrypy.request.paramList 172 172 body = page_handler(*args, **cherrypy.request.params) … … 183 183 encoding=encoding, allow_none=0) 184 184 self.respond(body) 185 cherrypy.request.execute Main = False185 cherrypy.request.execute_main = False 186 186 187 187 def after_error_response(self): trunk/cherrypy/test/helper.py
r885 r886 51 51 52 52 def on_start_resource(self): 53 path = cherrypy.request.object Path53 path = cherrypy.request.object_path 54 54 if path.startswith(self.prefix): 55 cherrypy.request.object Path = path[len(self.prefix):]55 cherrypy.request.object_path = path[len(self.prefix):] 56 56 vroot = "" 57 57 ##vroot = "/vpath" trunk/cherrypy/test/test_objectmapping.py
r856 r886 57 57 58 58 def myMethod(self): 59 return "myMethod from dir1, object Path is:" + repr(cherrypy.request.object Path)59 return "myMethod from dir1, object Path is:" + repr(cherrypy.request.object_path) 60 60 myMethod.exposed = True 61 61

