import mitsql config = mitsql.config.interface from MySQLdb import Connection as _connect from MySQLdb.cursors import DictCursor as _cursor def _connect(*argv, **kw): return _connect(config.db_host, config.db_user, config.db_pass, config.db_name, cursorclass=_Cursor) from handler import Root as _root root = _root() from cheetah import load load(mitsql._base + '/www/templates') import cherrypy cherrypy.tree.mount(root, '/') cherrypy.config.update({'error_page.404': root.error._404, 'error_page.500': root.error._500, 'tools.staticdir.on': True, 'tools.staticdir.dir': mitsql._base + '/www/root'}) def map_uri(): print root.default() #from cherrypy.lib.httpauth import parseAuthorization #if not cherrypy.request.login: # authorization = cherrypy.request.headers.get('Authorization', None) # if authorization: # cherrypy.request.login = parseAuthorization(authorization) #cherrypy.tools.map_uri = cherrypy.Tool('on_start_resource', map_uri) #cherrypy.tools.map_uri = cherrypy.Tool('before_request_body', map_uri)