]>
Commit | Line | Data |
---|---|---|
e4fd5e1b JP |
1 | import mitsql |
2 | config = mitsql.config.interface | |
3 | ||
4 | from MySQLdb import Connection as _connect | |
5 | from MySQLdb.cursors import DictCursor as _cursor | |
6 | ||
7 | def _connect(*argv, **kw): | |
8 | return _connect(config.db_host, config.db_user, config.db_pass, config.db_name, cursorclass=_Cursor) | |
5cb62ba9 | 9 | |
e4fd5e1b JP |
10 | from handler import Root as _root |
11 | root = _root() | |
12 | ||
13 | from cheetah import load | |
14 | load(mitsql._base + '/www/templates') | |
15 | ||
16 | import cherrypy | |
17 | cherrypy.tree.mount(root, '/') | |
18 | cherrypy.config.update({'error_page.404': root.error._404, | |
19 | 'error_page.500': root.error._500, | |
20 | 'tools.staticdir.on': True, | |
21 | 'tools.staticdir.dir': mitsql._base + '/www/root'}) | |
5cb62ba9 JP |
22 | |
23 | def map_uri(): | |
24 | print root.default() | |
25 | #from cherrypy.lib.httpauth import parseAuthorization | |
26 | #if not cherrypy.request.login: | |
27 | # authorization = cherrypy.request.headers.get('Authorization', None) | |
28 | # if authorization: | |
29 | # cherrypy.request.login = parseAuthorization(authorization) | |
30 | ||
e4fd5e1b | 31 | #cherrypy.tools.map_uri = cherrypy.Tool('on_start_resource', map_uri) |
5cb62ba9 | 32 | #cherrypy.tools.map_uri = cherrypy.Tool('before_request_body', map_uri) |