Ticket #613: is_dir.patch
-
__init__.py
old new 191 191 # (this is to support mistyped URL's without redirecting; 192 192 # if you want to redirect, use tools.trailing_slash). 193 193 pi = request.path_info 194 if request.is_ indexis True:194 if request.is_dir is True: 195 195 if pi[-1:] != '/': 196 196 pi = pi + '/' 197 elif request.is_ indexis False:197 elif request.is_dir is False: 198 198 if pi[-1:] == '/' and pi != '/': 199 199 pi = pi[:-1] 200 200 -
_cpdispatch.py
old new 131 131 conf = getattr(defhandler, "_cp_config", {}) 132 132 object_trail.insert(i+1, ["default", defhandler, conf, curpath]) 133 133 request.config = set_conf() 134 request.is_ index = False134 request.is_dir = True 135 135 return defhandler, names[i:-1] 136 136 137 137 # Uncomment the next line to restrict positional params to "default". … … 143 143 if i == num_candidates: 144 144 # We found the extra ".index". Mark request so tools 145 145 # can redirect if path_info has no trailing slash. 146 request.is_ index= True146 request.is_dir = True 147 147 else: 148 148 # We're not at an 'index' handler. Mark request so tools 149 149 # can redirect if path_info has NO trailing slash. 150 150 # Note that this also includes handlers which take 151 151 # positional parameters (virtual paths). 152 request.is_ index= False152 request.is_dir = False 153 153 return candidate, names[i:-1] 154 154 155 155 # We didn't find anything -
_cprequest.py
old new 165 165 handler = None 166 166 toolmaps = {} 167 167 config = None 168 is_ index= None168 is_dir = None 169 169 170 170 hooks = HookMap(hookpoints) 171 171 -
lib/cptools.py
old new 307 307 request = cherrypy.request 308 308 pi = request.path_info 309 309 310 if request.is_ indexis True:310 if request.is_dir is True: 311 311 if missing: 312 312 if pi[-1:] != '/': 313 313 new_url = cherrypy.url(pi + '/', request.query_string) 314 314 raise cherrypy.HTTPRedirect(new_url) 315 elif request.is_ indexis False:315 elif request.is_dir is False: 316 316 if extra: 317 317 # If pi == '/', don't redirect to ''! 318 318 if pi[-1:] == '/' and pi != '/':

