From: Michael Tremer Date: Mon, 23 Nov 2009 12:20:23 +0000 (+0100) Subject: Introduce LDAP database property. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=228d589d3cecf6cd30b44464febdee2595da9245;p=people%2Fms%2Fwebapp.git Introduce LDAP database property. --- diff --git a/application/__init__.py b/application/__init__.py index 79e02a1..74357d3 100644 --- a/application/__init__.py +++ b/application/__init__.py @@ -1,6 +1,7 @@ #!/usr/bin/python import os +import ldap import sys import tornado.web @@ -27,6 +28,8 @@ class Application(tornado.web.Application): (r"/logout", LogoutHandler), ] #self.get_handlers() + self.ldap = None # ldap.initialize("ldap://...") + tornado.web.Application.__init__(self, handlers, **settings) # # XXX This is not a nice solution but works for the moment diff --git a/application/handlers.py b/application/handlers.py index 48f56fa..b808eab 100644 --- a/application/handlers.py +++ b/application/handlers.py @@ -11,6 +11,10 @@ class BaseHandler(tornado.web.RequestHandler): def footer(self): return "%s" % socket.gethostname() + @property + def ldap(self): + return self.application.ldap + class MainHandler(BaseHandler): def get(self):