]> andersk Git - sql.git/blobdiff - lib/python/mitsql/interface/__init__.py
mako SQL interface
[sql.git] / lib / python / mitsql / interface / __init__.py
index 46366077124a57fe2399520ddbab453997fc3f6a..076cffafa54ae91bfee6c4f2284a249f23d289d4 100644 (file)
@@ -1,32 +1,15 @@
-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)
+import templates
+
+from cherrypy.process.plugins import DropPrivileges
+class DropSock(DropPrivileges):
+    def start(self):
+        if cherrypy.server.socket_file:
+            import os
+            os.chown(cherrypy.server.socket_file, self.uid, self.gid)
+        DropPrivileges.start(self)
+    start.priority = 78
+import cherrypy
+DropSock(cherrypy.engine, uid='lighttpd', gid='apache').subscribe()
 
 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)
This page took 0.485206 seconds and 4 git commands to generate.