From 83b2e65a9d83dc3372e9ffb7e1002bc7703b0541 Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Sat, 22 Nov 2014 14:14:41 +0100 Subject: [PATCH] =?UTF-8?q?[attributs]=20On=20=C3=A9vite=20d'utiliser=20ha?= =?UTF-8?q?sattr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Actuellement, ça retourne les attribut de self.value donc c'est confusionnant --- attributs.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/attributs.py b/attributs.py index 7bbd0de..32bbc8b 100644 --- a/attributs.py +++ b/attributs.py @@ -1185,6 +1185,10 @@ class responsable(Attr): ldap_name = "responsable" python_type = int # en vrai, c'est l'aid du responsable + def __init__(self, *args, **kwargs): + self._value = None + return super(responsable, self).__init__(*args, **kwargs) + def nonefunction(self, resp): """ Just... do... nothing. @@ -1198,7 +1202,7 @@ class responsable(Attr): """Méthode spéciale, pour aller avec property. On génère le respo quand c'est nécessaire, pas avant.""" - if hasattr(self, "_value"): + if self._value is not None: return self._value else: try: @@ -1224,6 +1228,10 @@ class imprimeurClub(Attr): can_modify = [cableur, nounou] ldap_name = "imprimeurClub" + def __init__(self, *args, **kwargs): + self._value = None + return super(imprimeurClub, self).__init__(*args, **kwargs) + def nonefunction(self, imprimeur): """ Just... do... nothing. @@ -1234,7 +1242,7 @@ class imprimeurClub(Attr): pass def get_imprimeur(self): - if hasattr(self, "_value"): + if self._value is not None: return self._value else: try: