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

Changeset 900

Show
Ignore:
Timestamp:
12/30/05 01:04:41
Author:
fumanchu
Message:

Fix for #402 (staticfilter errors if .on but no .file nor .dir).

Files:

Legend:

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

    r896 r900  
    2727        if not filename: 
    2828            staticDir = config.get('static_filter.dir') 
     29            if not staticDir: 
     30                msg = ("StaticFilter requires either static_filter.file " 
     31                       "or static_filter.dir (%s)" % request.path) 
     32                raise cherrypy.WrongConfigValue(msg) 
    2933            section = config.get('static_filter.dir', return_section=True) 
    3034            if section == 'global': 
  • trunk/cherrypy/test/test_static_filter.py

    r896 r900  
    4545        'static_filter.dir': 'static', 
    4646        'static_filter.index': 'index.html', 
     47    }, 
     48    '/error': { 
     49        'static_filter.on': True, 
     50        'server.show_tracebacks': True, 
    4751    }, 
    4852}) 
     
    100104        self.assertHeader('Content-Type', 'text/html') 
    101105        self.assertBody('Hello, world\r\n') 
     106         
     107        # Check that we get a WrongConfigValue error if no .file or .dir 
     108        self.getPage("/error/thing.html") 
     109        self.assertErrorPage(500) 
     110        self.assertInBody("WrongConfigValue: StaticFilter requires either " 
     111                          "static_filter.file or static_filter.dir " 
     112                          "(/error/thing.html)") 
    102113 
    103114 

Hosted by WebFaction

Log in as guest/cpguest to create tickets