From bf96220a276ab302d910a8babdf888f49459d6c2 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 25 Oct 2012 20:47:17 +0200 Subject: [PATCH] Singleton OK --- parse_args | 2 -- yunohost.py | 17 ++++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/parse_args b/parse_args index 07eca0a1..1bffd177 100755 --- a/parse_args +++ b/parse_args @@ -145,8 +145,6 @@ def parse_dict(action_map): args = parsers['general'].parse_args(sys.argv.extend(new_args)) args_dict = vars(args) - print patterns - print args_dict for key, value in patterns.items(): validate(value, args_dict[key]) diff --git a/yunohost.py b/yunohost.py index 63e299a4..89999b61 100644 --- a/yunohost.py +++ b/yunohost.py @@ -226,7 +226,10 @@ class YunoHostLDAP(Singleton): raise YunoHostError(13, _('Invalid credentials')) def __exit__(self, type, value, traceback): - self.disconnect() + try: + self.disconnect() + except: + pass def disconnect(self): """ @@ -236,12 +239,12 @@ class YunoHostLDAP(Singleton): Boolean | YunoHostError """ - #try: - self.conn.unbind_s() - #except: - # raise YunoHostError(169, _('An error occured during disconnection')) - #else: - # return True + try: + self.conn.unbind_s() + except: + raise YunoHostError(169, _('An error occured during disconnection')) + else: + return True def search(self, base=None, filter='(objectClass=*)', attrs=['dn']):