2021-02-15 15:17:23 +01:00
|
|
|
# Rédéfinition
|
|
|
|
|
|
|
|
## Redéfinition des vérification
|
|
|
|
|
|
|
|
Dans un premier dictionnaire déclarons notre variable et sa fonction de vérification :
|
|
|
|
|
2022-11-03 22:17:43 +01:00
|
|
|
```xml
|
2021-02-15 15:17:23 +01:00
|
|
|
<variables>
|
2021-12-11 16:33:55 +01:00
|
|
|
<variable name="my_variable"/>
|
2021-02-15 15:17:23 +01:00
|
|
|
</variables>
|
|
|
|
<constraints>
|
2021-12-11 16:33:55 +01:00
|
|
|
<check name="islower">
|
|
|
|
<target>my_variable</target>
|
|
|
|
</check>
|
2021-02-15 15:17:23 +01:00
|
|
|
</constraints>
|
|
|
|
```
|
|
|
|
|
2022-11-02 22:52:50 +01:00
|
|
|
En YAML :
|
|
|
|
|
2022-11-03 22:17:43 +01:00
|
|
|
```yml
|
2022-11-02 22:52:50 +01:00
|
|
|
variables:
|
|
|
|
- variable:
|
|
|
|
name: my_variable
|
|
|
|
constraints:
|
|
|
|
- check:
|
|
|
|
- name: islower
|
|
|
|
target:
|
|
|
|
- text: my_variable
|
|
|
|
```
|
|
|
|
|
2021-02-15 15:17:23 +01:00
|
|
|
Dans un second dictionnaire il est possible de redéfinir le calcul :
|
|
|
|
|
2022-11-03 22:17:43 +01:00
|
|
|
```xml
|
2021-02-15 15:17:23 +01:00
|
|
|
<variables>
|
2021-12-11 16:33:55 +01:00
|
|
|
<variable name="my_variable" redefine="True"/>
|
2021-02-15 15:17:23 +01:00
|
|
|
</variables>
|
|
|
|
<constraints>
|
2021-12-11 16:33:55 +01:00
|
|
|
<check name="isspace">
|
|
|
|
<target>my_variable</target>
|
|
|
|
</check>
|
2021-02-15 15:17:23 +01:00
|
|
|
</constraints>
|
|
|
|
```
|
|
|
|
|
2022-11-02 22:52:50 +01:00
|
|
|
En YAML :
|
|
|
|
|
2022-11-03 22:17:43 +01:00
|
|
|
```yml
|
2022-11-02 22:52:50 +01:00
|
|
|
variables:
|
|
|
|
- variable:
|
|
|
|
name: my_variable
|
2022-11-03 22:16:52 +01:00
|
|
|
redefine: true
|
2022-11-02 22:52:50 +01:00
|
|
|
constraints:
|
|
|
|
- check:
|
|
|
|
- name: isspace
|
|
|
|
target:
|
|
|
|
- text: my_variable
|
|
|
|
```
|
|
|
|
|
2021-02-15 15:17:23 +01:00
|
|
|
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 :
|
|
|
|
|
2022-11-03 22:17:43 +01:00
|
|
|
```xml
|
2021-02-15 15:17:23 +01:00
|
|
|
<variables>
|
2021-12-11 16:33:55 +01:00
|
|
|
<variable name="my_variable"/>
|
2021-02-15 15:17:23 +01:00
|
|
|
</variables>
|
|
|
|
<constraints>
|
2021-12-11 16:33:55 +01:00
|
|
|
<check name="islower">
|
|
|
|
<target>my_variable</target>
|
|
|
|
</check>
|
2021-02-15 15:17:23 +01:00
|
|
|
</constraints>
|
|
|
|
```
|
|
|
|
|
2022-11-02 22:52:50 +01:00
|
|
|
En YAML :
|
|
|
|
|
2022-11-03 22:17:43 +01:00
|
|
|
```yml
|
2022-11-02 22:52:50 +01:00
|
|
|
variables:
|
|
|
|
- variable:
|
|
|
|
name: my_variable
|
|
|
|
constraints:
|
|
|
|
- check:
|
|
|
|
- name: islower
|
|
|
|
target:
|
|
|
|
- text: my_variable
|
|
|
|
```
|
|
|
|
|
2021-02-15 15:17:23 +01:00
|
|
|
Dans un second dictionnaire supprimer cette vérification :
|
|
|
|
|
2022-11-03 22:17:43 +01:00
|
|
|
```xml
|
2021-02-15 15:17:23 +01:00
|
|
|
<variables>
|
2022-11-02 22:52:50 +01:00
|
|
|
<variable name="my_variable" redefine="True" remove_check="True"/>
|
2021-02-15 15:17:23 +01:00
|
|
|
</variables>
|
|
|
|
```
|
|
|
|
|
2022-11-02 22:52:50 +01:00
|
|
|
En YAML :
|
|
|
|
|
2022-11-03 22:17:43 +01:00
|
|
|
```yml
|
2022-11-02 22:52:50 +01:00
|
|
|
variables:
|
|
|
|
- variable:
|
|
|
|
name: my_variable
|
2022-11-03 22:16:52 +01:00
|
|
|
redefine: true
|
|
|
|
remove_check: true
|
2022-11-02 22:52:50 +01:00
|
|
|
```
|