add index function in leader
This commit is contained in:
parent
366ab9918b
commit
ea8bc3f02e
5 changed files with 9 additions and 0 deletions
|
@ -169,6 +169,9 @@ class RougailLeader:
|
|||
value = err
|
||||
self._follower[name].append(value)
|
||||
|
||||
def index(self, value):
|
||||
return self._value.index(value)
|
||||
|
||||
|
||||
class RougailExtra:
|
||||
"""Object that implement access to extra variable
|
||||
|
@ -310,6 +313,8 @@ class RougailBaseTemplate:
|
|||
destfilename = join(self.destinations_dir, true_destfilename[1:])
|
||||
makedirs(dirname(destfilename), exist_ok=True)
|
||||
self.log.info(_(f"{filevar['engine']} processing: '{destfilename}'"))
|
||||
if isfile(destfilename):
|
||||
raise TemplateError(_(f'destination file "{destfilename}" already exists'))
|
||||
self.engines[filevar['engine']].process(filename=filename,
|
||||
source=source,
|
||||
true_destfilename=true_destfilename,
|
||||
|
|
|
@ -9,3 +9,4 @@ testpre
|
|||
pretest
|
||||
leader2: test
|
||||
follower2: pre
|
||||
index: 0
|
||||
|
|
|
@ -9,3 +9,4 @@ testpre
|
|||
pretest
|
||||
leader2: test
|
||||
follower2: pre
|
||||
index: 0
|
||||
|
|
|
@ -33,3 +33,4 @@ diff
|
|||
%end for
|
||||
leader2: %%extra.ejabberd.new_name.description[0].description
|
||||
follower2: %%extra.ejabberd.new_name.description[0].mode
|
||||
index: %%extra.ejabberd.new_name.description.index('test')
|
||||
|
|
|
@ -31,3 +31,4 @@ diff
|
|||
{% endfor -%}
|
||||
leader2: {{ extra.ejabberd.new_name.description[0].description }}
|
||||
follower2: {{ extra.ejabberd.new_name.description[0].mode }}
|
||||
index: {{ extra.ejabberd.new_name.description.index('test') }}
|
||||
|
|
Loading…
Reference in a new issue