From 228d589d3cecf6cd30b44464febdee2595da9245 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 23 Nov 2009 13:20:23 +0100 Subject: [PATCH] Introduce LDAP database property. --- application/__init__.py | 3 +++ application/handlers.py | 4 ++++ 2 files changed, 7 insertions(+) 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): -- 2.47.3