~j5-dev/+junk/cherrypy3-3.2.0rc1

« back to all changes in this revision

Viewing changes to cherrypy/test/checkerdemo.py

  • Committer: steveh at sjsoft
  • Date: 2010-07-01 13:07:15 UTC
  • Revision ID: steveh@sjsoft.com-20100701130715-w56oim8346qzqlka
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
class Root:
 
13
    pass
 
14
 
 
15
if __name__ == '__main__':
 
16
    conf = {'/base': {'tools.staticdir.root': thisdir,
 
17
                      # Obsolete key.
 
18
                      'throw_errors': True,
 
19
                      },
 
20
            # This entry should be OK.
 
21
            '/base/static': {'tools.staticdir.on': True,
 
22
                        'tools.staticdir.dir': 'static'},
 
23
            # Warn on missing folder.
 
24
            '/base/js': {'tools.staticdir.on': True,
 
25
                    'tools.staticdir.dir': 'js'},
 
26
            # Warn on dir with an abs path even though we provide root.
 
27
            '/base/static2': {'tools.staticdir.on': True,
 
28
                         'tools.staticdir.dir': '/static'},
 
29
            # Warn on dir with a relative path with no root.
 
30
            '/static3': {'tools.staticdir.on': True,
 
31
                         'tools.staticdir.dir': 'static'},
 
32
            # Warn on unknown namespace
 
33
            '/unknown': {'toobles.gzip.on': True},
 
34
            # Warn special on cherrypy.<known ns>.*
 
35
            '/cpknown': {'cherrypy.tools.encode.on': True},
 
36
            # Warn on mismatched types
 
37
            '/conftype': {'request.show_tracebacks': 14},
 
38
            # Warn on unknown tool.
 
39
            '/web': {'tools.unknown.on': True},
 
40
            # Warn on server.* in app config.
 
41
            '/app1': {'server.socket_host': '0.0.0.0'},
 
42
            # Warn on 'localhost'
 
43
            'global': {'server.socket_host': 'localhost'},
 
44
            # Warn on '[name]'
 
45
            '[/extra_brackets]': {},
 
46
            }
 
47
    cherrypy.quickstart(Root(), config=conf)