summaryrefslogtreecommitdiffstats
path: root/pykolab/auth/__init__.py
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-03-02 12:00:51 +0000
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-03-02 12:00:51 +0000
commit1f42b362709a09e73e3a93a61dd5c967b0d47098 (patch)
treefe6753410e7ffc7bb4ae362ba4d37d34d4bd87f6 /pykolab/auth/__init__.py
parent9537a8ea971833c8e3a1624ab685f844f3aa8e8e (diff)
downloadpykolab-1f42b362709a09e73e3a93a61dd5c967b0d47098.tar.gz
Remove import not distributed, and only attempt to import the appropriate library after it's been verified the technology is actually used.
Remove unused import for IMAP Simplify initialization
Diffstat (limited to 'pykolab/auth/__init__.py')
-rw-r--r--pykolab/auth/__init__.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/pykolab/auth/__init__.py b/pykolab/auth/__init__.py
index 5a74675..f744cc1 100644
--- a/pykolab/auth/__init__.py
+++ b/pykolab/auth/__init__.py
@@ -16,10 +16,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-from pykolab.auth import ldap
-from pykolab.auth import sql
from pykolab.conf import Conf
-from pykolab.imap import IMAP
from pykolab.translate import _
@@ -32,13 +29,9 @@ class Auth(object):
"""
Initialize the authentication class.
"""
- if not conf:
- self.conf = Conf()
- self.conf.finalize_conf()
+ self.conf = conf
+ if hasattr(self.conf, "log"):
self.log = self.conf.log
- else:
- self.conf = conf
- self.log = conf.log
self._auth = None
@@ -47,6 +40,12 @@ class Auth(object):
return
if self.conf.get('kolab', 'auth_mechanism') == 'ldap':
+ try:
+ from pykolab.auth import ldap
+ except:
+ if hasattr(self, "log"):
+ self.log.error(_("Failure to import authentication layer %s," +
+ " please verify module dependencies have been installed") % "ldap")
self._auth = ldap.LDAP(self.conf)
def users(self):
@@ -55,7 +54,6 @@ class Auth(object):
return users
def set_user_attribute(self, user, attribute, value):
- print "Setting attribute %s to %s for user %s" %(attribute, value, user)
self._connect()
self._auth._set_user_attribute(user, attribute, value)