From f1633a429eba6a428bea3656dd54a725f23660bb Mon Sep 17 00:00:00 2001 From: nanu2 Date: Tue, 16 Sep 2014 12:36:33 +0200 Subject: [PATCH] added try catch --- ldappr/api.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ldappr/api.py b/ldappr/api.py index 294c9bf..12e9804 100644 --- a/ldappr/api.py +++ b/ldappr/api.py @@ -1,8 +1,13 @@ +import sys +import ldap from connection import Connection, AuthConnection def connect_to(server, *args, **kwargs): - if args or 'bind_dn' and 'password' in kwargs: - #if args: - return AuthConnection(server, *args, **kwargs) - return Connection(server, **kwargs) + try: + if args or 'bind_dn' and 'password' in kwargs: + return AuthConnection(server, *args, **kwargs) + return Connection(server, **kwargs) + except Exception as e: + print str(e) +