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

Ticket #613: is_dir.patch

  • __init__.py

    old new  
    191191            # (this is to support mistyped URL's without redirecting; 
    192192            # if you want to redirect, use tools.trailing_slash). 
    193193            pi = request.path_info 
    194             if request.is_index is True: 
     194            if request.is_dir is True: 
    195195                if pi[-1:] != '/': 
    196196                    pi = pi + '/' 
    197             elif request.is_index is False: 
     197            elif request.is_dir is False: 
    198198                if pi[-1:] == '/' and pi != '/': 
    199199                    pi = pi[:-1] 
    200200             
  • _cpdispatch.py

    old new  
    131131                    conf = getattr(defhandler, "_cp_config", {}) 
    132132                    object_trail.insert(i+1, ["default", defhandler, conf, curpath]) 
    133133                    request.config = set_conf() 
    134                     request.is_index = Fals
     134                    request.is_dir = Tru
    135135                    return defhandler, names[i:-1] 
    136136             
    137137            # Uncomment the next line to restrict positional params to "default". 
     
    143143                if i == num_candidates: 
    144144                    # We found the extra ".index". Mark request so tools 
    145145                    # can redirect if path_info has no trailing slash. 
    146                     request.is_index = True 
     146                    request.is_dir = True 
    147147                else: 
    148148                    # We're not at an 'index' handler. Mark request so tools 
    149149                    # can redirect if path_info has NO trailing slash. 
    150150                    # Note that this also includes handlers which take 
    151151                    # positional parameters (virtual paths). 
    152                     request.is_index = False 
     152                    request.is_dir = False 
    153153                return candidate, names[i:-1] 
    154154         
    155155        # We didn't find anything 
  • _cprequest.py

    old new  
    165165    handler = None 
    166166    toolmaps = {} 
    167167    config = None 
    168     is_index = None 
     168    is_dir = None 
    169169     
    170170    hooks = HookMap(hookpoints) 
    171171     
  • lib/cptools.py

    old new  
    307307    request = cherrypy.request 
    308308    pi = request.path_info 
    309309     
    310     if request.is_index is True: 
     310    if request.is_dir is True: 
    311311        if missing: 
    312312            if pi[-1:] != '/': 
    313313                new_url = cherrypy.url(pi + '/', request.query_string) 
    314314                raise cherrypy.HTTPRedirect(new_url) 
    315     elif request.is_index is False: 
     315    elif request.is_dir is False: 
    316316        if extra: 
    317317            # If pi == '/', don't redirect to ''! 
    318318            if pi[-1:] == '/' and pi != '/': 

Hosted by WebFaction

Log in as guest/cpguest to create tickets