added try catch

master
nanu2 2014-09-16 12:36:33 +02:00
parent de650f2858
commit f1633a429e
1 changed files with 9 additions and 4 deletions

View File

@ -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)