rougail/doc/check/redefine.md

1.3 KiB

Rédéfinition

Redéfinition des vérification

Dans un premier dictionnaire déclarons notre variable et sa fonction de vérification :

<variables>
  <variable name="my_variable"/>
</variables>
<constraints>
  <check name="islower">
    <target>my_variable</target>
  </check>
</constraints>

Dans un second dictionnaire il est possible de redéfinir le calcul :

<variables>
  <variable name="my_variable" redefine="True"/>
</variables>
<constraints>
  <check name="isspace">
    <target>my_variable</target>
  </check>
</constraints>

Dans ce cas, la fonction "islower" exécuté. Si cette fonction ne retourne pas d'erreur, la seconde fonction "isspace" sera exécuté.

Redéfinition avec suppression d'un calcul

Il se peut que dans un dictionnaire on décide de vérifier la valeur d'une variable.

Dans un second dictionnaire il est possible de supprimer cette vérification.

Dans un premier dictionnaire déclarons notre variable et notre fonction de vérification :

<variables>
  <variable name="my_variable"/>
</variables>
<constraints>
  <check name="islower">
    <target>my_variable</target>
  </check>
</constraints>

Dans un second dictionnaire supprimer cette vérification :

<variables>
  <family name="family">
    <variable name="my_variable" redefine="True" remove_check="True"/>
  </family>
</variables>