Eugeny/ajenti — pull request #333 by kstep (2014-04-01 09:51:49+00:00)
Title: make ldap library dependency optional

I don't have LDAP installed on by linuxbox, neither I want to use it, so I don't need python ldap library. And as it's not installed, Ajenti usersync modules which depend on LDAP (ActiveDirectory and LDAP) fail with `ImportError`. This is not nice, besides I think I'm not the only one who doesn't use LDAP but want to use Ajenti. The patch makes python-ldap dependency optional by catching `ImportError` and refusing to load usersync classes which depend on ldap if it's not available.

Also I noticed inconsistency in `ajenti.usersync.ActiveDirectorySyncProvider.test()` method, so I changed it to reflect the obvious intent of the code. I'm not sure it's correct fix, so please feel free to give me feedback on it. Thank you.