Package cherrypy :: Package test :: Module checkerdemo
[hide private]
[frames] | no frames]

Source Code for Module cherrypy.test.checkerdemo

 1  """Demonstration app for cherrypy.checker. 
 2   
 3  This application is intentionally broken and badly designed. 
 4  To demonstrate the output of the CherryPy Checker, simply execute 
 5  this module. 
 6  """ 
 7   
 8  import os 
 9  import cherrypy 
10  thisdir = os.path.dirname(os.path.abspath(__file__)) 
11   
12   
13 -class Root:
14 pass
15 16 if __name__ == '__main__': 17 conf = {'/base': {'tools.staticdir.root': thisdir, 18 # Obsolete key. 19 'throw_errors': True, 20 }, 21 # This entry should be OK. 22 '/base/static': {'tools.staticdir.on': True, 23 'tools.staticdir.dir': 'static'}, 24 # Warn on missing folder. 25 '/base/js': {'tools.staticdir.on': True, 26 'tools.staticdir.dir': 'js'}, 27 # Warn on dir with an abs path even though we provide root. 28 '/base/static2': {'tools.staticdir.on': True, 29 'tools.staticdir.dir': '/static'}, 30 # Warn on dir with a relative path with no root. 31 '/static3': {'tools.staticdir.on': True, 32 'tools.staticdir.dir': 'static'}, 33 # Warn on unknown namespace 34 '/unknown': {'toobles.gzip.on': True}, 35 # Warn special on cherrypy.<known ns>.* 36 '/cpknown': {'cherrypy.tools.encode.on': True}, 37 # Warn on mismatched types 38 '/conftype': {'request.show_tracebacks': 14}, 39 # Warn on unknown tool. 40 '/web': {'tools.unknown.on': True}, 41 # Warn on server.* in app config. 42 '/app1': {'server.socket_host': '0.0.0.0'}, 43 # Warn on 'localhost' 44 'global': {'server.socket_host': 'localhost'}, 45 # Warn on '[name]' 46 '[/extra_brackets]': {}, 47 } 48 cherrypy.quickstart(Root(), config=conf) 49