add rougail_index
This commit is contained in:
parent
ce45f37d09
commit
cdfa065550
|
@ -89,7 +89,7 @@ En effet, il est possible de passer le contenu d'une variable au template :
|
||||||
</variables>
|
</variables>
|
||||||
```
|
```
|
||||||
|
|
||||||
Dans ce cas, lors de la génération du fichier /etc/squid1/squid.conf on retrouvera la variable "rougail_variable" avec la valeur "squid1" et le fichier /etc/squid2/squid.conf on retrouvera la variable "rougail_variable" avec la valeur "squid2".
|
Dans ce cas, lors de la génération du fichier /etc/squid1/squid.conf on retrouvera la variable "rougail_variable" avec la valeur "squid1" et la variable "rougail_index" avec la valeur "0". Lors de la génération du fichier /etc/squid2/squid.conf on retrouvera la variable "rougail_variable" avec la valeur "squid2" et la variable "rougail_index" avec la valeur "1".
|
||||||
|
|
||||||
Attention : les deux variables "my_variable1" et "my_variable2" doivent être multiple et de même longueur.
|
Attention : les deux variables "my_variable1" et "my_variable2" doivent être multiple et de même longueur.
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,7 @@ def process(filename: str,
|
||||||
destfilename: str,
|
destfilename: str,
|
||||||
destdir: str,
|
destdir: str,
|
||||||
variable: Any,
|
variable: Any,
|
||||||
|
index: int,
|
||||||
rougail_variables_dict: Dict,
|
rougail_variables_dict: Dict,
|
||||||
eosfunc: Dict,
|
eosfunc: Dict,
|
||||||
):
|
):
|
||||||
|
@ -110,6 +111,8 @@ def process(filename: str,
|
||||||
}
|
}
|
||||||
if variable is not None:
|
if variable is not None:
|
||||||
extra_context['rougail_variable'] = variable
|
extra_context['rougail_variable'] = variable
|
||||||
|
if index is not None:
|
||||||
|
extra_context['rougail_index'] = index
|
||||||
cheetah_template = CheetahTemplate(filename,
|
cheetah_template = CheetahTemplate(filename,
|
||||||
source,
|
source,
|
||||||
rougail_variables_dict,
|
rougail_variables_dict,
|
||||||
|
|
|
@ -119,6 +119,7 @@ def process(filename: str,
|
||||||
destfilename: str,
|
destfilename: str,
|
||||||
destdir: str,
|
destdir: str,
|
||||||
variable: Any,
|
variable: Any,
|
||||||
|
index: int,
|
||||||
rougail_variables_dict: Dict,
|
rougail_variables_dict: Dict,
|
||||||
eosfunc: Dict,
|
eosfunc: Dict,
|
||||||
):
|
):
|
||||||
|
@ -132,6 +133,8 @@ def process(filename: str,
|
||||||
}
|
}
|
||||||
if variable is not None:
|
if variable is not None:
|
||||||
extra_context['rougail_variable'] = variable
|
extra_context['rougail_variable'] = variable
|
||||||
|
if index is not None:
|
||||||
|
extra_context['rougail_index'] = index
|
||||||
cheetah_template = CheetahTemplate(filename,
|
cheetah_template = CheetahTemplate(filename,
|
||||||
source,
|
source,
|
||||||
rougail_variables_dict,
|
rougail_variables_dict,
|
||||||
|
|
|
@ -39,6 +39,7 @@ def process(filename: str,
|
||||||
destfilename: str,
|
destfilename: str,
|
||||||
destdir: str,
|
destdir: str,
|
||||||
variable: Any,
|
variable: Any,
|
||||||
|
index: int,
|
||||||
rougail_variables_dict: Dict,
|
rougail_variables_dict: Dict,
|
||||||
eosfunc: Dict,
|
eosfunc: Dict,
|
||||||
):
|
):
|
||||||
|
@ -48,11 +49,11 @@ def process(filename: str,
|
||||||
dir_name, template_name = filename.rsplit('/', 1)
|
dir_name, template_name = filename.rsplit('/', 1)
|
||||||
if source is not None: # pragma: no cover
|
if source is not None: # pragma: no cover
|
||||||
raise TemplateError(_('source is not supported for jinja2'))
|
raise TemplateError(_('source is not supported for jinja2'))
|
||||||
rougail_variables_dict['rougail_variable'] = variable
|
|
||||||
if variable is not None:
|
|
||||||
var = {'rougail_variable': variable}
|
|
||||||
else:
|
|
||||||
var = {}
|
var = {}
|
||||||
|
if variable is not None:
|
||||||
|
var['rougail_variable'] = variable
|
||||||
|
if index is not None:
|
||||||
|
var['rougail_index'] = index
|
||||||
try:
|
try:
|
||||||
# extra_context = {'normalize_family': normalize_family,
|
# extra_context = {'normalize_family': normalize_family,
|
||||||
# eosfunc
|
# eosfunc
|
||||||
|
|
Loading…
Reference in New Issue