diff rhodecode/lib/auth.py @ 3632:1ec67ddcaffe beta

ldap: handle more elegantly that python-ldap isn't installed when trying to use ldap Don't fail with AttributeError: 'NoneType' object has no attribute 'SCOPE_SUBTREE' in the log.
author Mads Kiilerich <madski@unity3d.com>
date Thu, 28 Mar 2013 01:15:56 +0100
parents 260a7a01b054
children 3563bb7b4b82 7e3d89d9d3a2
line wrap: on
line diff
--- a/rhodecode/lib/auth.py	Thu Mar 28 03:34:36 2013 +0100
+++ b/rhodecode/lib/auth.py	Thu Mar 28 01:15:56 2013 +0100
@@ -40,7 +40,8 @@
 from rhodecode.model.meta import Session
 
 from rhodecode.lib.utils2 import str2bool, safe_unicode
-from rhodecode.lib.exceptions import LdapPasswordError, LdapUsernameError
+from rhodecode.lib.exceptions import LdapPasswordError, LdapUsernameError,\
+    LdapImportError
 from rhodecode.lib.utils import get_repo_slug, get_repos_group_slug
 from rhodecode.lib.auth_ldap import AuthLdap
 
@@ -241,7 +242,7 @@
 
                 Session().commit()
                 return True
-            except (LdapUsernameError, LdapPasswordError,):
+            except (LdapUsernameError, LdapPasswordError, LdapImportError):
                 pass
             except (Exception,):
                 log.error(traceback.format_exc())