From 55b2ff076ae6de880a51005020f97546bfc7d6df Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Tue, 17 Sep 2019 02:08:21 +0200 Subject: [PATCH] NEVER user _ for var; conflicts with _( from trad + remove return True --- cotisations/models.py | 8 ++++---- machines/models.py | 12 ++++++------ users/models.py | 2 -- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/cotisations/models.py b/cotisations/models.py index a2b44b52..32326983 100644 --- a/cotisations/models.py +++ b/cotisations/models.py @@ -169,7 +169,7 @@ class Facture(BaseInvoice): return self.vente_set.all() def can_edit(self, user_request, *args, **kwargs): - user_can, _, permissions = self.user.can_edit( + user_can, _message, permissions = self.user.can_edit( user_request, *args, **kwargs) if not user_request.has_perm('cotisations.change_facture'): return ( @@ -196,7 +196,7 @@ class Facture(BaseInvoice): return True, None, None def can_delete(self, user_request, *args, **kwargs): - user_can, _, permissions = self.user.can_edit( + user_can, _message, permissions = self.user.can_edit( user_request, *args, **kwargs) if not user_request.has_perm('cotisations.delete_facture'): return ( @@ -546,7 +546,7 @@ class Vente(RevMixin, AclMixin, models.Model): super(Vente, self).save(*args, **kwargs) def can_edit(self, user_request, *args, **kwargs): - user_can, _, permissions = self.facture.user.can_edit( + user_can, _message, permissions = self.facture.user.can_edit( user_request, *args, **kwargs ) if not user_request.has_perm('cotisations.change_vente'): @@ -575,7 +575,7 @@ class Vente(RevMixin, AclMixin, models.Model): return True, None, None def can_delete(self, user_request, *args, **kwargs): - user_can, _, permissions = self.facture.user.can_edit( + user_can, _message, permissions = self.facture.user.can_edit( user_request, *args, **kwargs) if not user_request.has_perm('cotisations.delete_vente'): return ( diff --git a/machines/models.py b/machines/models.py index a42a767b..11a4498b 100644 --- a/machines/models.py +++ b/machines/models.py @@ -168,7 +168,7 @@ class Machine(RevMixin, FieldPermissionModelMixin, models.Model): :param user_request: instance user qui fait l'edition :return: True ou False avec la raison le cas échéant""" if self.user != user_request: - can_user, _, permissions = self.user.can_edit( + can_user, _message, permissions = self.user.can_edit( self.user, user_request, *args, @@ -192,7 +192,7 @@ class Machine(RevMixin, FieldPermissionModelMixin, models.Model): :param user_request: instance user qui fait l'edition :return: True ou False avec la raison de l'échec le cas échéant""" if self.user != user_request: - can_user, _, permissions = self.user.can_edit( + can_user, _message, permissions = self.user.can_edit( self.user, user_request, *args, @@ -1307,7 +1307,7 @@ class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): :param user_request: Utilisateur qui fait la requête :return: soit True, soit False avec la raison de l'échec""" if self.machine.user != user_request: - can_user, _, permissions = self.machine.user.can_edit( + can_user, _message, permissions = self.machine.user.can_edit( user_request, *args, **kwargs @@ -1330,7 +1330,7 @@ class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): :param user_request: Utilisateur qui fait la requête :return: soit True, soit False avec la raison de l'échec""" if self.machine.user != user_request: - can_user, _, permissions = self.machine.user.can_edit( + can_user, _message, permissions = self.machine.user.can_edit( user_request, *args, **kwargs @@ -1435,7 +1435,7 @@ class Ipv6List(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): :param user_request: Utilisateur qui fait la requête :return: soit True, soit False avec la raison de l'échec""" if self.interface.machine.user != user_request: - can_user, _, permissions = self.interface.machine.user.can_edit( + can_user, _message, permissions = self.interface.machine.user.can_edit( user_request, *args, **kwargs @@ -1458,7 +1458,7 @@ class Ipv6List(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model): :param user_request: Utilisateur qui fait la requête :return: soit True, soit False avec la raison de l'échec""" if self.interface.machine.user != user_request: - can_user, _, permissions = self.interface.machine.user.can_edit( + can_user, _message, permissions = self.interface.machine.user.can_edit( user_request, *args, **kwargs diff --git a/users/models.py b/users/models.py index 1de58ea5..68719e0f 100755 --- a/users/models.py +++ b/users/models.py @@ -425,7 +425,6 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser, def is_adherent(self): """ Renvoie True si l'user est adhérent : si self.end_adhesion()>now""" - return True end = self.end_adhesion() if not end: return False @@ -437,7 +436,6 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser, def is_connected(self): """ Renvoie True si l'user est adhérent : si self.end_adhesion()>now et end_connexion>now""" - return True end = self.end_connexion() if not end: return False