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

Changeset 1668

Show
Ignore:
Timestamp:
06/16/07 18:35:25
Author:
fumanchu
Message:

Fix for #689 (add equivalent of trailing_slash tool for static content). The staticdir tool now sets request.is_index if needed. The trailing_slash tool priority was increased to allow most before_handler tools a chance to set is_index.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/_cptools.py

    r1667 r1668  
    430430_d.basic_auth = Tool('on_start_resource', auth.basic_auth) 
    431431_d.digest_auth = Tool('on_start_resource', auth.digest_auth) 
    432 _d.trailing_slash = Tool('before_handler', cptools.trailing_slash
     432_d.trailing_slash = Tool('before_handler', cptools.trailing_slash, priority=60
    433433_d.flatten = Tool('before_finalize', cptools.flatten) 
    434434_d.accept = Tool('on_start_resource', cptools.accept) 
  • trunk/cherrypy/lib/static.py

    r1402 r1668  
    180180    if not handled: 
    181181        # Check for an index file if a folder was requested. 
    182         if index and filename[-1] in (r"\/")
     182        if index
    183183            handled = _attempt(os.path.join(filename, index), content_types) 
     184            if handled: 
     185                cherrypy.request.is_index = filename[-1] in (r"\/") 
    184186    return handled 
    185187 
  • trunk/cherrypy/test/test_static.py

    r1514 r1668  
    110110        # The same page should be returned even if redirected. 
    111111        self.getPage("/docroot") 
    112         self.assertStatus('200 OK') 
    113         self.assertHeader('Content-Type', 'text/html') 
    114         self.assertBody('Hello, world\r\n') 
     112        self.assertStatus((302, 303)) 
    115113         
    116114        # Check that we get an error if no .file or .dir 

Hosted by WebFaction

Log in as guest/cpguest to create tickets