mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 03:13:12 +00:00
Fix unused variables in kwargs
This commit is contained in:
parent
1469c7d6a6
commit
0065e2e0f5
10 changed files with 102 additions and 102 deletions
|
@ -224,7 +224,7 @@ class Facture(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
|
|||
|
||||
|
||||
@receiver(post_save, sender=Facture)
|
||||
def facture_post_save(_sender, **kwargs):
|
||||
def facture_post_save(**kwargs):
|
||||
"""
|
||||
Synchronise the LDAP user after an invoice has been saved.
|
||||
"""
|
||||
|
@ -234,7 +234,7 @@ def facture_post_save(_sender, **kwargs):
|
|||
|
||||
|
||||
@receiver(post_delete, sender=Facture)
|
||||
def facture_post_delete(_sender, **kwargs):
|
||||
def facture_post_delete(**kwargs):
|
||||
"""
|
||||
Synchronise the LDAP user after an invoice has been deleted.
|
||||
"""
|
||||
|
@ -416,7 +416,7 @@ class Vente(RevMixin, AclMixin, models.Model):
|
|||
|
||||
# TODO : change vente to purchase
|
||||
@receiver(post_save, sender=Vente)
|
||||
def vente_post_save(_sender, **kwargs):
|
||||
def vente_post_save(**kwargs):
|
||||
"""
|
||||
Creates a 'cotisation' related object if needed and synchronise the
|
||||
LDAP user when a purchase has been saved.
|
||||
|
@ -434,7 +434,7 @@ def vente_post_save(_sender, **kwargs):
|
|||
|
||||
# TODO : change vente to purchase
|
||||
@receiver(post_delete, sender=Vente)
|
||||
def vente_post_delete(_sender, **kwargs):
|
||||
def vente_post_delete(**kwargs):
|
||||
"""
|
||||
Synchronise the LDAP user after a purchase has been deleted.
|
||||
"""
|
||||
|
@ -683,7 +683,7 @@ class Cotisation(RevMixin, AclMixin, models.Model):
|
|||
|
||||
|
||||
@receiver(post_save, sender=Cotisation)
|
||||
def cotisation_post_save(_sender, **_kwargs):
|
||||
def cotisation_post_save(**_kwargs):
|
||||
"""
|
||||
Mark some services as needing a regeneration after the edition of a
|
||||
cotisation. Indeed the membership status may have changed.
|
||||
|
@ -695,7 +695,7 @@ def cotisation_post_save(_sender, **_kwargs):
|
|||
|
||||
|
||||
@receiver(post_delete, sender=Cotisation)
|
||||
def cotisation_post_delete(_sender, **_kwargs):
|
||||
def cotisation_post_delete(**_kwargs):
|
||||
"""
|
||||
Mark some services as needing a regeneration after the deletion of a
|
||||
cotisation. Indeed the membership status may have changed.
|
||||
|
|
|
@ -263,7 +263,7 @@ def new_facture_pdf(request):
|
|||
# TODO : change facture to invoice
|
||||
@login_required
|
||||
@can_view(Facture)
|
||||
def facture_pdf(request, facture, _factureid):
|
||||
def facture_pdf(request, facture, **_kwargs):
|
||||
"""
|
||||
View used to generate a PDF file from an existing invoice in database
|
||||
Creates a line for each Purchase (thus article sold) and generate the
|
||||
|
@ -306,7 +306,7 @@ def facture_pdf(request, facture, _factureid):
|
|||
# TODO : change facture to invoice
|
||||
@login_required
|
||||
@can_edit(Facture)
|
||||
def edit_facture(request, facture, _factureid):
|
||||
def edit_facture(request, facture, **_kwargs):
|
||||
"""
|
||||
View used to edit an existing invoice.
|
||||
Articles can be added or remove to the invoice and quantity
|
||||
|
@ -347,7 +347,7 @@ def edit_facture(request, facture, _factureid):
|
|||
# TODO : change facture to invoice
|
||||
@login_required
|
||||
@can_delete(Facture)
|
||||
def del_facture(request, facture, _factureid):
|
||||
def del_facture(request, facture, **_kwargs):
|
||||
"""
|
||||
View used to delete an existing invocie.
|
||||
"""
|
||||
|
@ -368,7 +368,7 @@ def del_facture(request, facture, _factureid):
|
|||
@login_required
|
||||
@can_create(Facture)
|
||||
@can_edit(User)
|
||||
def credit_solde(request, user, _userid):
|
||||
def credit_solde(request, user, **_kwargs):
|
||||
"""
|
||||
View used to edit the balance of a user.
|
||||
Can be use either to increase or decrease a user's balance.
|
||||
|
@ -425,7 +425,7 @@ def add_article(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(Article)
|
||||
def edit_article(request, article_instance, _articleid):
|
||||
def edit_article(request, article_instance, **_kwargs):
|
||||
"""
|
||||
View used to edit an article.
|
||||
"""
|
||||
|
@ -489,7 +489,7 @@ def add_paiement(request):
|
|||
# TODO : chnage paiement to Payment
|
||||
@login_required
|
||||
@can_edit(Paiement)
|
||||
def edit_paiement(request, paiement_instance, _paiementid):
|
||||
def edit_paiement(request, paiement_instance, *_kwargs):
|
||||
"""
|
||||
View used to edit a payment method.
|
||||
"""
|
||||
|
@ -567,7 +567,7 @@ def add_banque(request):
|
|||
# TODO : change banque to bank
|
||||
@login_required
|
||||
@can_edit(Banque)
|
||||
def edit_banque(request, banque_instance, _bbanqueid):
|
||||
def edit_banque(request, banque_instance, **_kwargs):
|
||||
"""
|
||||
View used to edit a bank.
|
||||
"""
|
||||
|
|
|
@ -1519,7 +1519,7 @@ class OuverturePort(RevMixin, AclMixin, models.Model):
|
|||
|
||||
|
||||
@receiver(post_save, sender=Machine)
|
||||
def machine_post_save(_sender, **kwargs):
|
||||
def machine_post_save(**kwargs):
|
||||
"""Synchronisation ldap et régen parefeu/dhcp lors de la modification
|
||||
d'une machine"""
|
||||
user = kwargs['instance'].user
|
||||
|
@ -1529,7 +1529,7 @@ def machine_post_save(_sender, **kwargs):
|
|||
|
||||
|
||||
@receiver(post_delete, sender=Machine)
|
||||
def machine_post_delete(_sender, **kwargs):
|
||||
def machine_post_delete(**kwargs):
|
||||
"""Synchronisation ldap et régen parefeu/dhcp lors de la suppression
|
||||
d'une machine"""
|
||||
machine = kwargs['instance']
|
||||
|
@ -1540,7 +1540,7 @@ def machine_post_delete(_sender, **kwargs):
|
|||
|
||||
|
||||
@receiver(post_save, sender=Interface)
|
||||
def interface_post_save(_sender, **kwargs):
|
||||
def interface_post_save(**kwargs):
|
||||
"""Synchronisation ldap et régen parefeu/dhcp lors de la modification
|
||||
d'une interface"""
|
||||
interface = kwargs['instance']
|
||||
|
@ -1553,7 +1553,7 @@ def interface_post_save(_sender, **kwargs):
|
|||
|
||||
|
||||
@receiver(post_delete, sender=Interface)
|
||||
def interface_post_delete(_sender, **kwargs):
|
||||
def interface_post_delete(**kwargs):
|
||||
"""Synchronisation ldap et régen parefeu/dhcp lors de la suppression
|
||||
d'une interface"""
|
||||
interface = kwargs['instance']
|
||||
|
@ -1562,7 +1562,7 @@ def interface_post_delete(_sender, **kwargs):
|
|||
|
||||
|
||||
@receiver(post_save, sender=IpType)
|
||||
def iptype_post_save(_sender, **kwargs):
|
||||
def iptype_post_save(**kwargs):
|
||||
"""Generation des objets ip après modification d'un range ip"""
|
||||
iptype = kwargs['instance']
|
||||
iptype.gen_ip_range()
|
||||
|
@ -1570,7 +1570,7 @@ def iptype_post_save(_sender, **kwargs):
|
|||
|
||||
|
||||
@receiver(post_save, sender=MachineType)
|
||||
def machinetype_post_save(_sender, **kwargs):
|
||||
def machinetype_post_save(**kwargs):
|
||||
"""Mise à jour des interfaces lorsque changement d'attribution
|
||||
d'une machinetype (changement iptype parent)"""
|
||||
machinetype = kwargs['instance']
|
||||
|
@ -1579,84 +1579,84 @@ def machinetype_post_save(_sender, **kwargs):
|
|||
|
||||
|
||||
@receiver(post_save, sender=Domain)
|
||||
def domain_post_save(_sender, **_kwargs):
|
||||
def domain_post_save(**_kwargs):
|
||||
"""Regeneration dns après modification d'un domain object"""
|
||||
regen('dns')
|
||||
|
||||
|
||||
@receiver(post_delete, sender=Domain)
|
||||
def domain_post_delete(_sender, **_kwargs):
|
||||
def domain_post_delete(**_kwargs):
|
||||
"""Regeneration dns après suppression d'un domain object"""
|
||||
regen('dns')
|
||||
|
||||
|
||||
@receiver(post_save, sender=Extension)
|
||||
def extension_post_save(_sender, **_kwargs):
|
||||
def extension_post_save(**_kwargs):
|
||||
"""Regeneration dns après modification d'une extension"""
|
||||
regen('dns')
|
||||
|
||||
|
||||
@receiver(post_delete, sender=Extension)
|
||||
def extension_post_selete(_sender, **_kwargs):
|
||||
def extension_post_selete(**_kwargs):
|
||||
"""Regeneration dns après suppression d'une extension"""
|
||||
regen('dns')
|
||||
|
||||
|
||||
@receiver(post_save, sender=SOA)
|
||||
def soa_post_save(_sender, **_kwargs):
|
||||
def soa_post_save(**_kwargs):
|
||||
"""Regeneration dns après modification d'un SOA"""
|
||||
regen('dns')
|
||||
|
||||
|
||||
@receiver(post_delete, sender=SOA)
|
||||
def soa_post_delete(_sender, **_kwargs):
|
||||
def soa_post_delete(**_kwargs):
|
||||
"""Regeneration dns après suppresson d'un SOA"""
|
||||
regen('dns')
|
||||
|
||||
|
||||
@receiver(post_save, sender=Mx)
|
||||
def mx_post_save(_sender, **_kwargs):
|
||||
def mx_post_save(**_kwargs):
|
||||
"""Regeneration dns après modification d'un MX"""
|
||||
regen('dns')
|
||||
|
||||
|
||||
@receiver(post_delete, sender=Mx)
|
||||
def mx_post_delete(_sender, **_kwargs):
|
||||
def mx_post_delete(**_kwargs):
|
||||
"""Regeneration dns après suppresson d'un MX"""
|
||||
regen('dns')
|
||||
|
||||
|
||||
@receiver(post_save, sender=Ns)
|
||||
def ns_post_save(_sender, **_kwargs):
|
||||
def ns_post_save(**_kwargs):
|
||||
"""Regeneration dns après modification d'un NS"""
|
||||
regen('dns')
|
||||
|
||||
|
||||
@receiver(post_delete, sender=Ns)
|
||||
def ns_post_delete(_sender, **_kwargs):
|
||||
def ns_post_delete(**_kwargs):
|
||||
"""Regeneration dns après modification d'un NS"""
|
||||
regen('dns')
|
||||
|
||||
|
||||
@receiver(post_save, sender=Txt)
|
||||
def text_post_save(_sender, **_kwargs):
|
||||
def text_post_save(**_kwargs):
|
||||
"""Regeneration dns après modification d'un TXT"""
|
||||
regen('dns')
|
||||
|
||||
|
||||
@receiver(post_delete, sender=Txt)
|
||||
def text_post_delete(_sender, **_kwargs):
|
||||
def text_post_delete(**_kwargs):
|
||||
"""Regeneration dns après modification d'un TX"""
|
||||
regen('dns')
|
||||
|
||||
|
||||
@receiver(post_save, sender=Srv)
|
||||
def srv_post_save(_sender, **_kwargs):
|
||||
def srv_post_save(**_kwargs):
|
||||
"""Regeneration dns après modification d'un SRV"""
|
||||
regen('dns')
|
||||
|
||||
|
||||
@receiver(post_delete, sender=Srv)
|
||||
def srv_post_delete(_sender, **_kwargs):
|
||||
def srv_post_delete(**_kwargs):
|
||||
"""Regeneration dns après modification d'un SRV"""
|
||||
regen('dns')
|
||||
|
|
|
@ -220,7 +220,7 @@ def generate_ipv4_mbf_param(form_obj, is_type_tt):
|
|||
@login_required
|
||||
@can_create(Machine)
|
||||
@can_edit(User)
|
||||
def new_machine(request, user, _userid):
|
||||
def new_machine(request, user, **_kwargs):
|
||||
""" Fonction de creation d'une machine. Cree l'objet machine,
|
||||
le sous objet interface et l'objet domain à partir de model forms.
|
||||
Trop complexe, devrait être simplifié"""
|
||||
|
@ -264,7 +264,7 @@ def new_machine(request, user, _userid):
|
|||
|
||||
@login_required
|
||||
@can_edit(Interface)
|
||||
def edit_interface(request, interface_instance, _interfaceid):
|
||||
def edit_interface(request, interface_instance, **_kwargs):
|
||||
""" Edition d'une interface. Distingue suivant les droits les valeurs
|
||||
de interfaces et machines que l'user peut modifier infra permet de
|
||||
modifier le propriétaire"""
|
||||
|
@ -316,7 +316,7 @@ def edit_interface(request, interface_instance, _interfaceid):
|
|||
|
||||
@login_required
|
||||
@can_delete(Machine)
|
||||
def del_machine(request, machine, _machineid):
|
||||
def del_machine(request, machine, **_kwargs):
|
||||
""" Supprime une machine, interfaces en mode cascade"""
|
||||
if request.method == "POST":
|
||||
machine.delete()
|
||||
|
@ -335,7 +335,7 @@ def del_machine(request, machine, _machineid):
|
|||
@login_required
|
||||
@can_create(Interface)
|
||||
@can_edit(Machine)
|
||||
def new_interface(request, machine, _machineid):
|
||||
def new_interface(request, machine, **_kwargs):
|
||||
""" Ajoute une interface et son domain associé à une machine existante"""
|
||||
|
||||
interface_form = AddInterfaceForm(request.POST or None, user=request.user)
|
||||
|
@ -369,7 +369,7 @@ def new_interface(request, machine, _machineid):
|
|||
|
||||
@login_required
|
||||
@can_delete(Interface)
|
||||
def del_interface(request, interface, _interfaceid):
|
||||
def del_interface(request, interface, **_kwargs):
|
||||
""" Supprime une interface. Domain objet en mode cascade"""
|
||||
if request.method == "POST":
|
||||
machine = interface.machine
|
||||
|
@ -391,7 +391,7 @@ def del_interface(request, interface, _interfaceid):
|
|||
@login_required
|
||||
@can_create(Ipv6List)
|
||||
@can_edit(Interface)
|
||||
def new_ipv6list(request, interface, _interfaceid):
|
||||
def new_ipv6list(request, interface, **_kwargs):
|
||||
"""Nouvelle ipv6"""
|
||||
ipv6list_instance = Ipv6List(interface=interface)
|
||||
ipv6 = Ipv6ListForm(
|
||||
|
@ -415,7 +415,7 @@ def new_ipv6list(request, interface, _interfaceid):
|
|||
|
||||
@login_required
|
||||
@can_edit(Ipv6List)
|
||||
def edit_ipv6list(request, ipv6list_instance, _ipv6listid):
|
||||
def edit_ipv6list(request, ipv6list_instance, **_kwargs):
|
||||
"""Edition d'une ipv6"""
|
||||
ipv6 = Ipv6ListForm(
|
||||
request.POST or None,
|
||||
|
@ -439,7 +439,7 @@ def edit_ipv6list(request, ipv6list_instance, _ipv6listid):
|
|||
|
||||
@login_required
|
||||
@can_delete(Ipv6List)
|
||||
def del_ipv6list(request, ipv6list, _ipv6listid):
|
||||
def del_ipv6list(request, ipv6list, **_kwargs):
|
||||
""" Supprime une ipv6"""
|
||||
if request.method == "POST":
|
||||
interfaceid = ipv6list.interface.id
|
||||
|
@ -476,7 +476,7 @@ def add_iptype(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(IpType)
|
||||
def edit_iptype(request, iptype_instance, _iptypeid):
|
||||
def edit_iptype(request, iptype_instance, **_kwargs):
|
||||
""" Edition d'un range. Ne permet pas de le redimensionner pour éviter
|
||||
l'incohérence"""
|
||||
|
||||
|
@ -536,7 +536,7 @@ def add_machinetype(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(MachineType)
|
||||
def edit_machinetype(request, machinetype_instance, _machinetypeid):
|
||||
def edit_machinetype(request, machinetype_instance, **_kwargs):
|
||||
""" View used to edit a MachineType object """
|
||||
machinetype = MachineTypeForm(
|
||||
request.POST or None,
|
||||
|
@ -598,7 +598,7 @@ def add_extension(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(Extension)
|
||||
def edit_extension(request, extension_instance, _extensionid):
|
||||
def edit_extension(request, extension_instance, **_kwargs):
|
||||
""" View used to edit an Extension object """
|
||||
extension = ExtensionForm(
|
||||
request.POST or None,
|
||||
|
@ -660,7 +660,7 @@ def add_soa(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(SOA)
|
||||
def edit_soa(request, soa_instance, _soaid):
|
||||
def edit_soa(request, soa_instance, **_kwargs):
|
||||
""" View used to edit a SOA object """
|
||||
soa = SOAForm(request.POST or None, instance=soa_instance)
|
||||
if soa.is_valid():
|
||||
|
@ -718,7 +718,7 @@ def add_mx(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(Mx)
|
||||
def edit_mx(request, mx_instance, _mxid):
|
||||
def edit_mx(request, mx_instance, **_kwargs):
|
||||
""" View used to edit a MX object """
|
||||
mx = MxForm(request.POST or None, instance=mx_instance)
|
||||
if mx.is_valid():
|
||||
|
@ -776,7 +776,7 @@ def add_ns(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(Ns)
|
||||
def edit_ns(request, ns_instance, _nsid):
|
||||
def edit_ns(request, ns_instance, **_kwargs):
|
||||
""" View used to edit a NS object """
|
||||
ns = NsForm(request.POST or None, instance=ns_instance)
|
||||
if ns.is_valid():
|
||||
|
@ -834,7 +834,7 @@ def add_txt(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(Txt)
|
||||
def edit_txt(request, txt_instance, _txtid):
|
||||
def edit_txt(request, txt_instance, **_kwargs):
|
||||
""" View used to edit a TXT object """
|
||||
txt = TxtForm(request.POST or None, instance=txt_instance)
|
||||
if txt.is_valid():
|
||||
|
@ -892,7 +892,7 @@ def add_srv(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(Srv)
|
||||
def edit_srv(request, srv_instance, _srvid):
|
||||
def edit_srv(request, srv_instance, **_kwargs):
|
||||
""" View used to edit a SRV object """
|
||||
srv = SrvForm(request.POST or None, instance=srv_instance)
|
||||
if srv.is_valid():
|
||||
|
@ -956,7 +956,7 @@ def add_alias(request, interface, interfaceid):
|
|||
|
||||
@login_required
|
||||
@can_edit(Domain)
|
||||
def edit_alias(request, domain_instance, _domainid):
|
||||
def edit_alias(request, domain_instance, **_kwargs):
|
||||
""" View used to edit an Alias object """
|
||||
alias = AliasForm(
|
||||
request.POST or None,
|
||||
|
@ -1029,7 +1029,7 @@ def add_service(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(Service)
|
||||
def edit_service(request, service_instance, _serviceid):
|
||||
def edit_service(request, service_instance, **_kwargs):
|
||||
""" View used to edit a Service object """
|
||||
service = ServiceForm(request.POST or None, instance=service_instance)
|
||||
if service.is_valid():
|
||||
|
@ -1087,7 +1087,7 @@ def add_vlan(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(Vlan)
|
||||
def edit_vlan(request, vlan_instance, _vlanid):
|
||||
def edit_vlan(request, vlan_instance, **_kwargs):
|
||||
""" View used to edit a VLAN object """
|
||||
vlan = VlanForm(request.POST or None, instance=vlan_instance)
|
||||
if vlan.is_valid():
|
||||
|
@ -1145,7 +1145,7 @@ def add_nas(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(Nas)
|
||||
def edit_nas(request, nas_instance, _nasid):
|
||||
def edit_nas(request, nas_instance, **_kwargs):
|
||||
""" View used to edit a NAS object """
|
||||
nas = NasForm(request.POST or None, instance=nas_instance)
|
||||
if nas.is_valid():
|
||||
|
@ -1378,7 +1378,7 @@ def index_portlist(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(OuverturePortList)
|
||||
def edit_portlist(request, ouvertureportlist_instance, _ouvertureportlistid):
|
||||
def edit_portlist(request, ouvertureportlist_instance, **_kwargs):
|
||||
""" View used to edit a port policy """
|
||||
port_list = EditOuverturePortListForm(
|
||||
request.POST or None,
|
||||
|
@ -1417,7 +1417,7 @@ def edit_portlist(request, ouvertureportlist_instance, _ouvertureportlistid):
|
|||
|
||||
@login_required
|
||||
@can_delete(OuverturePortList)
|
||||
def del_portlist(request, port_list_instance, _ouvertureportlistid):
|
||||
def del_portlist(request, port_list_instance, **_kwargs):
|
||||
""" View used to delete a port policy """
|
||||
port_list_instance.delete()
|
||||
messages.success(request, "La liste de ports a été supprimée")
|
||||
|
@ -1457,7 +1457,7 @@ def add_portlist(request):
|
|||
@login_required
|
||||
@can_create(OuverturePort)
|
||||
@can_edit(Interface)
|
||||
def configure_ports(request, interface_instance, _interfaceid):
|
||||
def configure_ports(request, interface_instance, **_kwargs):
|
||||
""" View to display the list of configured port policy for an
|
||||
interface """
|
||||
if not interface_instance.may_have_port_open():
|
||||
|
|
|
@ -118,7 +118,7 @@ class OptionalUser(AclMixin, PreferencesModel):
|
|||
|
||||
|
||||
@receiver(post_save, sender=OptionalUser)
|
||||
def optionaluser_post_save(_sender, **kwargs):
|
||||
def optionaluser_post_save(**kwargs):
|
||||
"""Ecriture dans le cache"""
|
||||
user_pref = kwargs['instance']
|
||||
user_pref.set_in_cache()
|
||||
|
@ -163,7 +163,7 @@ class OptionalMachine(AclMixin, PreferencesModel):
|
|||
|
||||
|
||||
@receiver(post_save, sender=OptionalMachine)
|
||||
def optionalmachine_post_save(_sender, **kwargs):
|
||||
def optionalmachine_post_save(**kwargs):
|
||||
"""Synchronisation ipv6 et ecriture dans le cache"""
|
||||
machine_pref = kwargs['instance']
|
||||
machine_pref.set_in_cache()
|
||||
|
@ -211,7 +211,7 @@ class OptionalTopologie(AclMixin, PreferencesModel):
|
|||
|
||||
|
||||
@receiver(post_save, sender=OptionalTopologie)
|
||||
def optionaltopologie_post_save(_sender, **kwargs):
|
||||
def optionaltopologie_post_save(**kwargs):
|
||||
"""Ecriture dans le cache"""
|
||||
topologie_pref = kwargs['instance']
|
||||
topologie_pref.set_in_cache()
|
||||
|
@ -251,7 +251,7 @@ class GeneralOption(AclMixin, PreferencesModel):
|
|||
|
||||
|
||||
@receiver(post_save, sender=GeneralOption)
|
||||
def generaloption_post_save(_sender, **kwargs):
|
||||
def generaloption_post_save(**kwargs):
|
||||
"""Ecriture dans le cache"""
|
||||
general_pref = kwargs['instance']
|
||||
general_pref.set_in_cache()
|
||||
|
@ -325,7 +325,7 @@ class AssoOption(AclMixin, PreferencesModel):
|
|||
|
||||
|
||||
@receiver(post_save, sender=AssoOption)
|
||||
def assooption_post_save(_sender, **kwargs):
|
||||
def assooption_post_save(**kwargs):
|
||||
"""Ecriture dans le cache"""
|
||||
asso_pref = kwargs['instance']
|
||||
asso_pref.set_in_cache()
|
||||
|
|
|
@ -136,7 +136,7 @@ def add_service(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(Service)
|
||||
def edit_service(request, service_instance, _serviceid):
|
||||
def edit_service(request, service_instance, **_kwargs):
|
||||
"""Edition des services affichés sur la page d'accueil"""
|
||||
service = ServiceForm(request.POST or None, instance=service_instance)
|
||||
if service.is_valid():
|
||||
|
|
|
@ -411,18 +411,18 @@ class Room(AclMixin, RevMixin, models.Model):
|
|||
|
||||
|
||||
@receiver(post_save, sender=AccessPoint)
|
||||
def ap_post_save(_sender, **_kwargs):
|
||||
def ap_post_save(**_kwargs):
|
||||
"""Regeneration des noms des bornes vers le controleur"""
|
||||
regen('unifi-ap-names')
|
||||
|
||||
|
||||
@receiver(post_delete, sender=AccessPoint)
|
||||
def ap_post_delete(_sender, **_kwargs):
|
||||
def ap_post_delete(**_kwargs):
|
||||
"""Regeneration des noms des bornes vers le controleur"""
|
||||
regen('unifi-ap-names')
|
||||
|
||||
|
||||
@receiver(post_delete, sender=Stack)
|
||||
def stack_post_delete(_sender, **_kwargs):
|
||||
def stack_post_delete(**_kwargs):
|
||||
"""Vide les id des switches membres d'une stack supprimée"""
|
||||
Switch.objects.filter(stack=None).update(stack_member_id=None)
|
||||
|
|
|
@ -296,7 +296,7 @@ def new_port(request, switchid):
|
|||
|
||||
@login_required
|
||||
@can_edit(Port)
|
||||
def edit_port(request, port_object, _portid):
|
||||
def edit_port(request, port_object, **_kwargs):
|
||||
""" Edition d'un port. Permet de changer le switch parent et
|
||||
l'affectation du port"""
|
||||
|
||||
|
@ -322,7 +322,7 @@ def edit_port(request, port_object, _portid):
|
|||
|
||||
@login_required
|
||||
@can_delete(Port)
|
||||
def del_port(request, port, _portid):
|
||||
def del_port(request, port, **_kwargs):
|
||||
""" Supprime le port"""
|
||||
if request.method == "POST":
|
||||
try:
|
||||
|
@ -358,7 +358,7 @@ def new_stack(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(Stack)
|
||||
def edit_stack(request, stack, _stackid):
|
||||
def edit_stack(request, stack, **_kwargs):
|
||||
"""Edition d'un stack (nombre de switches, nom...)"""
|
||||
stack = StackForm(request.POST or None, instance=stack)
|
||||
if stack.is_valid():
|
||||
|
@ -374,7 +374,7 @@ def edit_stack(request, stack, _stackid):
|
|||
|
||||
@login_required
|
||||
@can_delete(Stack)
|
||||
def del_stack(request, stack, _stackid):
|
||||
def del_stack(request, stack, **_kwargs):
|
||||
"""Supprime un stack"""
|
||||
if request.method == "POST":
|
||||
try:
|
||||
|
@ -392,7 +392,7 @@ def del_stack(request, stack, _stackid):
|
|||
|
||||
@login_required
|
||||
@can_edit(Stack)
|
||||
def edit_switchs_stack(request, stack, _stackid):
|
||||
def edit_switchs_stack(request, stack, **_kwargs):
|
||||
"""Permet d'éditer la liste des switches dans une stack et l'ajouter"""
|
||||
|
||||
if request.method == "POST":
|
||||
|
@ -599,7 +599,7 @@ def new_ap(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(AccessPoint)
|
||||
def edit_ap(request, ap, _accesspointid):
|
||||
def edit_ap(request, ap, **_kwargs):
|
||||
""" Edition d'un switch. Permet de chambre nombre de ports,
|
||||
place dans le stack, interface et machine associée"""
|
||||
interface_form = EditInterfaceForm(
|
||||
|
@ -668,7 +668,7 @@ def new_room(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(Room)
|
||||
def edit_room(request, room, _roomid):
|
||||
def edit_room(request, room, **_kwargs):
|
||||
""" Edition numero et details de la chambre"""
|
||||
room = EditRoomForm(request.POST or None, instance=room)
|
||||
if room.is_valid():
|
||||
|
@ -685,7 +685,7 @@ def edit_room(request, room, _roomid):
|
|||
|
||||
@login_required
|
||||
@can_delete(Room)
|
||||
def del_room(request, room, _roomid):
|
||||
def del_room(request, room, **_kwargs):
|
||||
""" Suppression d'un chambre"""
|
||||
if request.method == "POST":
|
||||
try:
|
||||
|
@ -723,7 +723,7 @@ def new_model_switch(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(ModelSwitch)
|
||||
def edit_model_switch(request, model_switch, _modelswitchid):
|
||||
def edit_model_switch(request, model_switch, **_kwargs):
|
||||
""" Edition d'un modèle de switch"""
|
||||
|
||||
model_switch = EditModelSwitchForm(
|
||||
|
@ -744,7 +744,7 @@ def edit_model_switch(request, model_switch, _modelswitchid):
|
|||
|
||||
@login_required
|
||||
@can_delete(ModelSwitch)
|
||||
def del_model_switch(request, model_switch, _modelswitchid):
|
||||
def del_model_switch(request, model_switch, **_kwargs):
|
||||
""" Suppression d'un modèle de switch"""
|
||||
if request.method == "POST":
|
||||
try:
|
||||
|
@ -782,7 +782,7 @@ def new_switch_bay(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(SwitchBay)
|
||||
def edit_switch_bay(request, switch_bay, _switchbayid):
|
||||
def edit_switch_bay(request, switch_bay, **_kwargs):
|
||||
""" Edition d'une baie de switch"""
|
||||
switch_bay = EditSwitchBayForm(request.POST or None, instance=switch_bay)
|
||||
if switch_bay.is_valid():
|
||||
|
@ -799,7 +799,7 @@ def edit_switch_bay(request, switch_bay, _switchbayid):
|
|||
|
||||
@login_required
|
||||
@can_delete(SwitchBay)
|
||||
def del_switch_bay(request, switch_bay, _switchbayid):
|
||||
def del_switch_bay(request, switch_bay, **_kwargs):
|
||||
""" Suppression d'une baie de switch"""
|
||||
if request.method == "POST":
|
||||
try:
|
||||
|
@ -837,7 +837,7 @@ def new_building(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(Building)
|
||||
def edit_building(request, building, _buildingid):
|
||||
def edit_building(request, building, **_kwargs):
|
||||
""" Edition d'un batiment"""
|
||||
building = EditBuildingForm(request.POST or None, instance=building)
|
||||
if building.is_valid():
|
||||
|
@ -854,7 +854,7 @@ def edit_building(request, building, _buildingid):
|
|||
|
||||
@login_required
|
||||
@can_delete(Building)
|
||||
def del_building(request, building, _buildingid):
|
||||
def del_building(request, building, **_kwargs):
|
||||
""" Suppression d'un batiment"""
|
||||
if request.method == "POST":
|
||||
try:
|
||||
|
@ -892,7 +892,7 @@ def new_constructor_switch(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(ConstructorSwitch)
|
||||
def edit_constructor_switch(request, constructor_switch, _constructorswitchid):
|
||||
def edit_constructor_switch(request, constructor_switch, **_kwargs):
|
||||
""" Edition d'un constructeur de switch"""
|
||||
|
||||
constructor_switch = EditConstructorSwitchForm(
|
||||
|
@ -913,7 +913,7 @@ def edit_constructor_switch(request, constructor_switch, _constructorswitchid):
|
|||
|
||||
@login_required
|
||||
@can_delete(ConstructorSwitch)
|
||||
def del_constructor_switch(request, constructor_switch, _constructorswitchid):
|
||||
def del_constructor_switch(request, constructor_switch, **_kwargs):
|
||||
""" Suppression d'un constructeur de switch"""
|
||||
if request.method == "POST":
|
||||
try:
|
||||
|
|
|
@ -993,7 +993,7 @@ class Club(User):
|
|||
@receiver(post_save, sender=Adherent)
|
||||
@receiver(post_save, sender=Club)
|
||||
@receiver(post_save, sender=User)
|
||||
def user_post_save(_sender, **kwargs):
|
||||
def user_post_save(**kwargs):
|
||||
""" Synchronisation post_save : envoie le mail de bienvenue si creation
|
||||
Synchronise le ldap"""
|
||||
# is_created = kwargs['created']
|
||||
|
@ -1013,7 +1013,7 @@ def user_post_save(_sender, **kwargs):
|
|||
@receiver(post_delete, sender=Adherent)
|
||||
@receiver(post_delete, sender=Club)
|
||||
@receiver(post_delete, sender=User)
|
||||
def user_post_delete(_sender, **kwargs):
|
||||
def user_post_delete(**kwargs):
|
||||
"""Post delete d'un user, on supprime son instance ldap"""
|
||||
user = kwargs['instance']
|
||||
user.ldap_del()
|
||||
|
@ -1100,14 +1100,14 @@ class ServiceUser(RevMixin, AclMixin, AbstractBaseUser):
|
|||
|
||||
|
||||
@receiver(post_save, sender=ServiceUser)
|
||||
def service_user_post_save(_sender, **kwargs):
|
||||
def service_user_post_save(**kwargs):
|
||||
""" Synchronise un service user ldap après modification django"""
|
||||
service_user = kwargs['instance']
|
||||
service_user.ldap_sync()
|
||||
|
||||
|
||||
@receiver(post_delete, sender=ServiceUser)
|
||||
def service_user_post_delete(_sender, **kwargs):
|
||||
def service_user_post_delete(**kwargs):
|
||||
""" Supprime un service user ldap après suppression django"""
|
||||
service_user = kwargs['instance']
|
||||
service_user.ldap_del()
|
||||
|
@ -1182,14 +1182,14 @@ class ListRight(RevMixin, AclMixin, Group):
|
|||
|
||||
|
||||
@receiver(post_save, sender=ListRight)
|
||||
def listright_post_save(_sender, **kwargs):
|
||||
def listright_post_save(**kwargs):
|
||||
""" Synchronise le droit ldap quand il est modifié"""
|
||||
right = kwargs['instance']
|
||||
right.ldap_sync()
|
||||
|
||||
|
||||
@receiver(post_delete, sender=ListRight)
|
||||
def listright_post_delete(_sender, **kwargs):
|
||||
def listright_post_delete(**kwargs):
|
||||
"""Suppression d'un groupe ldap après suppression coté django"""
|
||||
right = kwargs['instance']
|
||||
right.ldap_del()
|
||||
|
@ -1282,7 +1282,7 @@ class Ban(RevMixin, AclMixin, models.Model):
|
|||
|
||||
|
||||
@receiver(post_save, sender=Ban)
|
||||
def ban_post_save(_sender, **kwargs):
|
||||
def ban_post_save(**kwargs):
|
||||
""" Regeneration de tous les services après modification d'un ban"""
|
||||
ban = kwargs['instance']
|
||||
is_created = kwargs['created']
|
||||
|
@ -1299,7 +1299,7 @@ def ban_post_save(_sender, **kwargs):
|
|||
|
||||
|
||||
@receiver(post_delete, sender=Ban)
|
||||
def ban_post_delete(_sender, **kwargs):
|
||||
def ban_post_delete(**kwargs):
|
||||
""" Regen de tous les services après suppression d'un ban"""
|
||||
user = kwargs['instance'].user
|
||||
user.ldap_sync(base=False, access_refresh=True, mac_refresh=False)
|
||||
|
@ -1348,7 +1348,7 @@ class Whitelist(RevMixin, AclMixin, models.Model):
|
|||
|
||||
|
||||
@receiver(post_save, sender=Whitelist)
|
||||
def whitelist_post_save(_sender, **kwargs):
|
||||
def whitelist_post_save(**kwargs):
|
||||
"""Après modification d'une whitelist, on synchronise les services
|
||||
et on lui permet d'avoir internet"""
|
||||
whitelist = kwargs['instance']
|
||||
|
@ -1365,7 +1365,7 @@ def whitelist_post_save(_sender, **kwargs):
|
|||
|
||||
|
||||
@receiver(post_delete, sender=Whitelist)
|
||||
def whitelist_post_delete(_sender, **kwargs):
|
||||
def whitelist_post_delete(**kwargs):
|
||||
"""Après suppression d'une whitelist, on supprime l'accès internet
|
||||
en forçant la régénration"""
|
||||
user = kwargs['instance'].user
|
||||
|
|
|
@ -158,7 +158,7 @@ def new_club(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(Club)
|
||||
def edit_club_admin_members(request, club_instance, _clubid):
|
||||
def edit_club_admin_members(request, club_instance, **_kwargs):
|
||||
"""Vue d'edition de la liste des users administrateurs et
|
||||
membres d'un club"""
|
||||
club = ClubAdminandMembersForm(
|
||||
|
@ -286,7 +286,7 @@ def password(request, user, userid):
|
|||
|
||||
@login_required
|
||||
@can_edit(User, 'groups')
|
||||
def del_group(request, user, _userid, listrightid):
|
||||
def del_group(request, user, listrightid, **_kwargs):
|
||||
""" View used to delete a group """
|
||||
user.groups.remove(ListRight.objects.get(id=listrightid))
|
||||
user.save()
|
||||
|
@ -317,7 +317,7 @@ def new_serviceuser(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(ServiceUser)
|
||||
def edit_serviceuser(request, serviceuser, _serviceuserid):
|
||||
def edit_serviceuser(request, serviceuser, **_kwargs):
|
||||
""" Edit a ServiceUser """
|
||||
serviceuser = EditServiceUserForm(
|
||||
request.POST or None,
|
||||
|
@ -340,7 +340,7 @@ def edit_serviceuser(request, serviceuser, _serviceuserid):
|
|||
|
||||
@login_required
|
||||
@can_delete(ServiceUser)
|
||||
def del_serviceuser(request, serviceuser, _serviceuserid):
|
||||
def del_serviceuser(request, serviceuser, **_kwargs):
|
||||
"""Suppression d'un ou plusieurs serviceusers"""
|
||||
if request.method == "POST":
|
||||
serviceuser.delete()
|
||||
|
@ -383,7 +383,7 @@ def add_ban(request, user, userid):
|
|||
|
||||
@login_required
|
||||
@can_edit(Ban)
|
||||
def edit_ban(request, ban_instance, _banid):
|
||||
def edit_ban(request, ban_instance, **_kwargs):
|
||||
""" Editer un bannissement, nécessite au moins le droit bofh
|
||||
(a fortiori bureau)
|
||||
Syntaxe : JJ/MM/AAAA , heure optionnelle, prend effet immédiatement"""
|
||||
|
@ -434,7 +434,7 @@ def add_whitelist(request, user, userid):
|
|||
|
||||
@login_required
|
||||
@can_edit(Whitelist)
|
||||
def edit_whitelist(request, whitelist_instance, _whitelistid):
|
||||
def edit_whitelist(request, whitelist_instance, **_kwargs):
|
||||
""" Editer un accès gracieux, temporaire ou permanent.
|
||||
Need droit cableur
|
||||
Syntaxe : JJ/MM/AAAA , heure optionnelle, prend effet immédiatement,
|
||||
|
@ -474,7 +474,7 @@ def add_school(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(School)
|
||||
def edit_school(request, school_instance, _schoolid):
|
||||
def edit_school(request, school_instance, **_kwargs):
|
||||
""" Editer un établissement d'enseignement à partir du schoolid dans
|
||||
la base de donnée, need cableur"""
|
||||
school = SchoolForm(request.POST or None, instance=school_instance)
|
||||
|
@ -535,7 +535,7 @@ def add_shell(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(ListShell)
|
||||
def edit_shell(request, shell_instance, _listshellid):
|
||||
def edit_shell(request, shell_instance, **_kwargs):
|
||||
""" Editer un shell à partir du listshellid"""
|
||||
shell = ShellForm(request.POST or None, instance=shell_instance)
|
||||
if shell.is_valid():
|
||||
|
@ -552,7 +552,7 @@ def edit_shell(request, shell_instance, _listshellid):
|
|||
|
||||
@login_required
|
||||
@can_delete(ListShell)
|
||||
def del_shell(request, shell, _listshellid):
|
||||
def del_shell(request, shell, **_kwargs):
|
||||
"""Destruction d'un shell"""
|
||||
if request.method == "POST":
|
||||
shell.delete()
|
||||
|
@ -584,7 +584,7 @@ def add_listright(request):
|
|||
|
||||
@login_required
|
||||
@can_edit(ListRight)
|
||||
def edit_listright(request, listright_instance, _listrightid):
|
||||
def edit_listright(request, listright_instance, **_kwargs):
|
||||
""" Editer un groupe/droit, necessite droit bureau,
|
||||
à partir du listright id """
|
||||
listright = ListRightForm(
|
||||
|
@ -798,7 +798,7 @@ def mon_profil(request):
|
|||
|
||||
@login_required
|
||||
@can_view(User)
|
||||
def profil(request, users, _userid):
|
||||
def profil(request, users, **_kwargs):
|
||||
""" Affiche un profil, self or cableur, prend un userid en argument """
|
||||
machines = Machine.objects.filter(user=users).select_related('user')\
|
||||
.prefetch_related('interface_set__domain__extension')\
|
||||
|
|
Loading…
Reference in a new issue