fix: property calculated with disabled variable
This commit is contained in:
parent
c5134247a0
commit
38fa8447eb
25 changed files with 210 additions and 44 deletions
|
|
@ -701,10 +701,12 @@ class RougailOutputDoc(Examples):
|
|||
def _calculation_variable_to_string(self, child, calculation, prop):
|
||||
if prop in PROPERTY_ATTRIBUTE:
|
||||
variable_path, value, condition = calculation["value"]
|
||||
variable = self.conf.unrestraint.option(variable_path)
|
||||
variable = self.conf.forcepermissive.option(variable_path)
|
||||
try:
|
||||
variable.value.get()
|
||||
except AttributeError as err:
|
||||
if prop in HIDDEN_PROPERTIES:
|
||||
return False
|
||||
variable = None
|
||||
if variable and self._is_inaccessible_user_data(variable):
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -22,9 +22,8 @@ My var3. +
|
|||
|
|
||||
|
||||
**var4** +
|
||||
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `mandatory` `__hidden__` |
|
||||
My var4. +
|
||||
**Hidden**: when the variable "a.unknown.variable" has the value "value".
|
||||
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `mandatory` |
|
||||
My var4.
|
||||
|
|
||||
|
||||
**var5** +
|
||||
|
|
@ -81,26 +80,22 @@ A variable.
|
|||
|
|
||||
|
||||
**var_10** +
|
||||
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `mandatory` `__hidden__` |
|
||||
My var10. +
|
||||
**Hidden**: when the variable "a.unknown.variable" has the value "val".
|
||||
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `mandatory` |
|
||||
My var10.
|
||||
|
|
||||
|
||||
**var_11** +
|
||||
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `mandatory` `__hidden__` |
|
||||
My var11. +
|
||||
**Hidden**: when the variable "a.unknown.variable" hasn't the value "val".
|
||||
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `mandatory` |
|
||||
My var11.
|
||||
|
|
||||
|
||||
**var_12** +
|
||||
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `mandatory` `__hidden__` |
|
||||
My var12. +
|
||||
**Hidden**: when the variable "a.unknown.variable" is defined and has the value "true".
|
||||
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `mandatory` |
|
||||
My var12.
|
||||
|
|
||||
|
||||
**var_13** +
|
||||
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `mandatory` `__hidden__` |
|
||||
My var13. +
|
||||
**Hidden**: when the variable "a.unknown.variable" has the value "true".
|
||||
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `mandatory` |
|
||||
My var13.
|
||||
|====
|
||||
|
||||
|
|
|
|||
|
|
@ -10,9 +10,8 @@ A condition. +
|
|||
|
|
||||
|
||||
**var1** +
|
||||
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `standard` `__hidden__` |
|
||||
A first variable. +
|
||||
**Hidden**: when the variable "unknown" is defined and has the value "true".
|
||||
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `standard` |
|
||||
A first variable.
|
||||
|
|
||||
|
||||
**var3** +
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
| Variable | Description |
|
||||
|------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------|
|
||||
| **condition**<br/>[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | A condition.<br/>**Default**: false |
|
||||
| **var1**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` *`hidden`* | A first variable.<br/>**Hidden**: when the variable "unknown" is defined and has the value "true". |
|
||||
| **var1**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` | A first variable. |
|
||||
| **var3**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` *`hidden`* | A second variable.<br/>**Hidden**: when the variable "condition" is defined and has the value "true". |
|
||||
| **var4**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` *`hidden`* | A forth variable.<br/>**Hidden**: when the variable "condition" is defined and has the value "true". |
|
||||
|
||||
|
|
|
|||
|
|
@ -39,11 +39,6 @@
|
|||
{
|
||||
"type": "mode",
|
||||
"name": "standard"
|
||||
},
|
||||
{
|
||||
"type": "property",
|
||||
"name": "hidden",
|
||||
"annotation": "when the variable \"unknown\" is defined and has the value \"true\"."
|
||||
}
|
||||
],
|
||||
"paths": [
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
| Variable | Description |
|
||||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| **condition**<br/>[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | A condition.<br/>**Default**: false |
|
||||
| **var1**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` *`hidden`* | A first variable.<br/>**Hidden**: when the variable "unknown" is defined and has the value "true". |
|
||||
| **var1**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` | A first variable. |
|
||||
| **var3**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` *`hidden`* | A second variable.<br/>**Hidden**: when the variable "condition" is defined and has the value "true". |
|
||||
| **var4**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` *`hidden`* | A forth variable.<br/>**Hidden**: when the variable "condition" is defined and has the value "true". |
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@
|
|||
│ [1;7m boolean [0m [1;7m standard [0m [1;7m mandatory [0m │ [1mDefault[0m: false │
|
||||
├───────────────────────────────────────┼──────────────────────────────────────┤
|
||||
│ [1mvar1[0m │ A first variable. │
|
||||
│ [1;7m string [0m [1;7m standard [0m [1;3;7m hidden [0m │ [1mHidden[0m: when the variable "unknown" │
|
||||
│ │ is defined and has the value "true". │
|
||||
│ [1;7m string [0m [1;7m standard [0m │ │
|
||||
├───────────────────────────────────────┼──────────────────────────────────────┤
|
||||
│ [1mvar3[0m │ A second variable. │
|
||||
│ [1;7m string [0m [1;7m standard [0m [1;3;7m hidden [0m │ [1mHidden[0m: when the variable │
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
[cols="1a,1a"]
|
||||
|====
|
||||
| Variable | Description
|
||||
|
|
||||
|
||||
**variable** +
|
||||
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `basic` `mandatory` |
|
||||
A variable.
|
||||
|====
|
||||
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
| Variable | Description |
|
||||
|-------------------------------------------------------------------------------------------------------------------------|---------------|
|
||||
| **variable**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | A variable. |
|
||||
|
||||
|
|
@ -1 +1,28 @@
|
|||
{}
|
||||
{
|
||||
"variable": {
|
||||
"type": "variable",
|
||||
"properties": [
|
||||
{
|
||||
"type": "type",
|
||||
"name": "string"
|
||||
},
|
||||
{
|
||||
"type": "mode",
|
||||
"name": "basic"
|
||||
},
|
||||
{
|
||||
"type": "property",
|
||||
"name": "mandatory"
|
||||
}
|
||||
],
|
||||
"paths": [
|
||||
"variable"
|
||||
],
|
||||
"names": [
|
||||
"variable"
|
||||
],
|
||||
"descriptions": [
|
||||
"A variable."
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
| Variable | Description |
|
||||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| **variable**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | A variable. |
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃[1m [0m[1mVariable [0m[1m [0m┃[1m [0m[1mDescription [0m[1m [0m┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ [1mvariable[0m │ A variable. │
|
||||
│ [1;7m string [0m [1;7m basic [0m [1;7m mandatory [0m │ │
|
||||
└───────────────────────────────────────┴──────────────────────────────────────┘
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
# Example with mandatory variables not filled in
|
||||
|
||||
```yaml
|
||||
---
|
||||
variable: example
|
||||
```
|
||||
# Example with all variables modifiable
|
||||
|
||||
```yaml
|
||||
---
|
||||
variable: example
|
||||
```
|
||||
|
|
@ -16,9 +16,8 @@ A condition. +
|
|||
|
|
||||
|
||||
**rougail.var1** +
|
||||
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `standard` `__hidden__` |
|
||||
A first variable. +
|
||||
**Hidden**: when the variable "rougail.unknown" is defined and has the value "true".
|
||||
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `standard` |
|
||||
A first variable.
|
||||
|
|
||||
|
||||
**rougail.var3** +
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
| Variable | Description |
|
||||
|--------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|
|
||||
| **rougail.condition**<br/>[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | A condition.<br/>**Default**: false |
|
||||
| **rougail.var1**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` *`hidden`* | A first variable.<br/>**Hidden**: when the variable "rougail.unknown" is defined and has the value "true". |
|
||||
| **rougail.var1**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` | A first variable. |
|
||||
| **rougail.var3**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` *`hidden`* | A second variable.<br/>**Hidden**: when the variable "rougail.condition" is defined and has the value "true". |
|
||||
| **rougail.var4**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` *`hidden`* | A forth variable.<br/>**Hidden**: when the variable "rougail.condition" is defined and has the value "true". |
|
||||
|
||||
|
|
|
|||
|
|
@ -57,11 +57,6 @@
|
|||
{
|
||||
"type": "mode",
|
||||
"name": "standard"
|
||||
},
|
||||
{
|
||||
"type": "property",
|
||||
"name": "hidden",
|
||||
"annotation": "when the variable \"rougail.unknown\" is defined and has the value \"true\"."
|
||||
}
|
||||
],
|
||||
"paths": [
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
| Variable | Description |
|
||||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| **rougail.condition**<br/>[`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` `mandatory` | A condition.<br/>**Default**: false |
|
||||
| **rougail.var1**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` *`hidden`* | A first variable.<br/>**Hidden**: when the variable "rougail.unknown" is defined and has the value "true". |
|
||||
| **rougail.var1**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` | A first variable. |
|
||||
| **rougail.var3**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` *`hidden`* | A second variable.<br/>**Hidden**: when the variable "rougail.condition" is defined and has the value "true". |
|
||||
| **rougail.var4**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `standard` *`hidden`* | A forth variable.<br/>**Hidden**: when the variable "rougail.condition" is defined and has the value "true". |
|
||||
|
||||
|
|
|
|||
|
|
@ -19,9 +19,7 @@
|
|||
│ [1;7m boolean [0m [1;7m standard [0m [1;7m mandatory [0m │ [1mDefault[0m: false │
|
||||
├───────────────────────────────────────┼──────────────────────────────────────┤
|
||||
│ [1mrougail.var1[0m │ A first variable. │
|
||||
│ [1;7m string [0m [1;7m standard [0m [1;3;7m hidden [0m │ [1mHidden[0m: when the variable │
|
||||
│ │ "rougail.unknown" is defined and has │
|
||||
│ │ the value "true". │
|
||||
│ [1;7m string [0m [1;7m standard [0m │ │
|
||||
├───────────────────────────────────────┼──────────────────────────────────────┤
|
||||
│ [1mrougail.var3[0m │ A second variable. │
|
||||
│ [1;7m string [0m [1;7m standard [0m [1;3;7m hidden [0m │ [1mHidden[0m: when the variable │
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
== Variables for "Rougail"
|
||||
|
||||
**rougail**
|
||||
|
||||
`basic`
|
||||
|
||||
[cols="1a,1a"]
|
||||
|====
|
||||
| Variable | Description
|
||||
|
|
||||
|
||||
**rougail.variable** +
|
||||
`https://rougail.readthedocs.io/en/latest/variable.html#variables-types[string]` `basic` `mandatory` |
|
||||
A variable.
|
||||
|====
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<details><summary>Rougail</summary>
|
||||
|
||||
>>> [!note] Informations
|
||||
**rougail**<br>`basic`
|
||||
|
||||
|
||||
>>>
|
||||
| Variable | Description |
|
||||
|---------------------------------------------------------------------------------------------------------------------------------|---------------|
|
||||
| **rougail.variable**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | A variable. |
|
||||
|
||||
</details>
|
||||
|
||||
|
|
@ -1 +1,48 @@
|
|||
{}
|
||||
{
|
||||
"rougail": {
|
||||
"type": "namespace",
|
||||
"informations": {
|
||||
"paths": [
|
||||
"rougail"
|
||||
],
|
||||
"names": [
|
||||
"rougail"
|
||||
],
|
||||
"description": "Rougail",
|
||||
"properties": [
|
||||
{
|
||||
"type": "mode",
|
||||
"name": "basic"
|
||||
}
|
||||
]
|
||||
},
|
||||
"children": {
|
||||
"rougail.variable": {
|
||||
"type": "variable",
|
||||
"properties": [
|
||||
{
|
||||
"type": "type",
|
||||
"name": "string"
|
||||
},
|
||||
{
|
||||
"type": "mode",
|
||||
"name": "basic"
|
||||
},
|
||||
{
|
||||
"type": "property",
|
||||
"name": "mandatory"
|
||||
}
|
||||
],
|
||||
"paths": [
|
||||
"rougail.variable"
|
||||
],
|
||||
"names": [
|
||||
"variable"
|
||||
],
|
||||
"descriptions": [
|
||||
"A variable."
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
# Variables for "Rougail"
|
||||
|
||||
**rougail**
|
||||
|
||||
`basic`
|
||||
|
||||
| Variable | Description |
|
||||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| **rougail.variable**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | A variable. |
|
||||
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
|
||||
[1;4;96mVariables for [0m[1;4;96m"Rougail"[0m
|
||||
|
||||
|
||||
|
||||
[1mrougail[0m
|
||||
|
||||
|
||||
|
||||
[1;7m basic [0m
|
||||
|
||||
|
||||
|
||||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
||||
┃[1m [0m[1mVariable [0m[1m [0m┃[1m [0m[1mDescription [0m[1m [0m┃
|
||||
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
||||
│ [1mrougail.variable[0m │ A variable. │
|
||||
│ [1;7m string [0m [1;7m basic [0m [1;7m mandatory [0m │ │
|
||||
└───────────────────────────────────────┴──────────────────────────────────────┘
|
||||
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
# Example with mandatory variables not filled in
|
||||
|
||||
```yaml
|
||||
---
|
||||
rougail:
|
||||
variable: example
|
||||
```
|
||||
# Example with all variables modifiable
|
||||
|
||||
```yaml
|
||||
---
|
||||
rougail:
|
||||
variable: example
|
||||
```
|
||||
|
|
@ -20,7 +20,7 @@ excludes = [
|
|||
]
|
||||
|
||||
test_ok = get_structures_list(excludes)
|
||||
# test_ok = [HERE.parent.parent / "rougail-tests" / "structures" / "04_5disabled_calculation_variable9"]
|
||||
# test_ok = [HERE.parent.parent / "rougail-tests" / "structures" / "04_5disabled_calculation_variable6"]
|
||||
|
||||
os.environ['COLUMNS'] = '80'
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue