added try catch

This commit is contained in:
nanu2 committed 2014-09-16 12:36:33 +02:00
1 parent de650f2858
commit f1633a429e
1 file changed
+6 -1
+6 -1
View File
@@ -1,8 +1,13 @@
import sys
import ldap
from connection import Connection, AuthConnection
def connect_to(server, *args, **kwargs):
try:
if args or 'bind_dn' and 'password' in kwargs:
#if args:
return AuthConnection(server, *args, **kwargs)
return Connection(server, **kwargs)
except Exception as e:
print str(e)