8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-09 03:16:25 +00:00

NEVER user _ for var; conflicts with _( from trad + remove return True

This commit is contained in:
Gabriel Detraz 2019-09-17 02:08:21 +02:00 committed by root
parent e9d362db29
commit 55b2ff076a
3 changed files with 10 additions and 12 deletions

View file

@ -169,7 +169,7 @@ class Facture(BaseInvoice):
return self.vente_set.all() return self.vente_set.all()
def can_edit(self, user_request, *args, **kwargs): 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) user_request, *args, **kwargs)
if not user_request.has_perm('cotisations.change_facture'): if not user_request.has_perm('cotisations.change_facture'):
return ( return (
@ -196,7 +196,7 @@ class Facture(BaseInvoice):
return True, None, None return True, None, None
def can_delete(self, user_request, *args, **kwargs): 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) user_request, *args, **kwargs)
if not user_request.has_perm('cotisations.delete_facture'): if not user_request.has_perm('cotisations.delete_facture'):
return ( return (
@ -546,7 +546,7 @@ class Vente(RevMixin, AclMixin, models.Model):
super(Vente, self).save(*args, **kwargs) super(Vente, self).save(*args, **kwargs)
def can_edit(self, user_request, *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 user_request, *args, **kwargs
) )
if not user_request.has_perm('cotisations.change_vente'): if not user_request.has_perm('cotisations.change_vente'):
@ -575,7 +575,7 @@ class Vente(RevMixin, AclMixin, models.Model):
return True, None, None return True, None, None
def can_delete(self, user_request, *args, **kwargs): 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) user_request, *args, **kwargs)
if not user_request.has_perm('cotisations.delete_vente'): if not user_request.has_perm('cotisations.delete_vente'):
return ( return (

View file

@ -168,7 +168,7 @@ class Machine(RevMixin, FieldPermissionModelMixin, models.Model):
:param user_request: instance user qui fait l'edition :param user_request: instance user qui fait l'edition
:return: True ou False avec la raison le cas échéant""" :return: True ou False avec la raison le cas échéant"""
if self.user != user_request: if self.user != user_request:
can_user, _, permissions = self.user.can_edit( can_user, _message, permissions = self.user.can_edit(
self.user, self.user,
user_request, user_request,
*args, *args,
@ -192,7 +192,7 @@ class Machine(RevMixin, FieldPermissionModelMixin, models.Model):
:param user_request: instance user qui fait l'edition :param user_request: instance user qui fait l'edition
:return: True ou False avec la raison de l'échec le cas échéant""" :return: True ou False avec la raison de l'échec le cas échéant"""
if self.user != user_request: if self.user != user_request:
can_user, _, permissions = self.user.can_edit( can_user, _message, permissions = self.user.can_edit(
self.user, self.user,
user_request, user_request,
*args, *args,
@ -1307,7 +1307,7 @@ class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
:param user_request: Utilisateur qui fait la requête :param user_request: Utilisateur qui fait la requête
:return: soit True, soit False avec la raison de l'échec""" :return: soit True, soit False avec la raison de l'échec"""
if self.machine.user != user_request: 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, user_request,
*args, *args,
**kwargs **kwargs
@ -1330,7 +1330,7 @@ class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
:param user_request: Utilisateur qui fait la requête :param user_request: Utilisateur qui fait la requête
:return: soit True, soit False avec la raison de l'échec""" :return: soit True, soit False avec la raison de l'échec"""
if self.machine.user != user_request: 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, user_request,
*args, *args,
**kwargs **kwargs
@ -1435,7 +1435,7 @@ class Ipv6List(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
:param user_request: Utilisateur qui fait la requête :param user_request: Utilisateur qui fait la requête
:return: soit True, soit False avec la raison de l'échec""" :return: soit True, soit False avec la raison de l'échec"""
if self.interface.machine.user != user_request: 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, user_request,
*args, *args,
**kwargs **kwargs
@ -1458,7 +1458,7 @@ class Ipv6List(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
:param user_request: Utilisateur qui fait la requête :param user_request: Utilisateur qui fait la requête
:return: soit True, soit False avec la raison de l'échec""" :return: soit True, soit False avec la raison de l'échec"""
if self.interface.machine.user != user_request: 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, user_request,
*args, *args,
**kwargs **kwargs

View file

@ -425,7 +425,6 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
def is_adherent(self): def is_adherent(self):
""" Renvoie True si l'user est adhérent : si """ Renvoie True si l'user est adhérent : si
self.end_adhesion()>now""" self.end_adhesion()>now"""
return True
end = self.end_adhesion() end = self.end_adhesion()
if not end: if not end:
return False return False
@ -437,7 +436,6 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
def is_connected(self): def is_connected(self):
""" Renvoie True si l'user est adhérent : si """ Renvoie True si l'user est adhérent : si
self.end_adhesion()>now et end_connexion>now""" self.end_adhesion()>now et end_connexion>now"""
return True
end = self.end_connexion() end = self.end_connexion()
if not end: if not end:
return False return False