removed jinaj2 override restrictions
This commit is contained in:
parent
113f709eac
commit
07e5e98cbf
1 changed files with 1 additions and 4 deletions
|
@ -47,7 +47,6 @@ __all__ = ['Templar']
|
||||||
NON_TEMPLATED_TYPES = ( bool, Number )
|
NON_TEMPLATED_TYPES = ( bool, Number )
|
||||||
|
|
||||||
JINJA2_OVERRIDE = '#jinja2:'
|
JINJA2_OVERRIDE = '#jinja2:'
|
||||||
JINJA2_ALLOWED_OVERRIDES = frozenset(['trim_blocks', 'lstrip_blocks', 'newline_sequence', 'keep_trailing_newline'])
|
|
||||||
|
|
||||||
class Templar:
|
class Templar:
|
||||||
'''
|
'''
|
||||||
|
@ -279,7 +278,6 @@ class Templar:
|
||||||
if overrides is None:
|
if overrides is None:
|
||||||
myenv = self.environment.overlay()
|
myenv = self.environment.overlay()
|
||||||
else:
|
else:
|
||||||
overrides = JINJA2_ALLOWED_OVERRIDES.intersection(set(overrides))
|
|
||||||
myenv = self.environment.overlay(overrides)
|
myenv = self.environment.overlay(overrides)
|
||||||
|
|
||||||
# Get jinja env overrides from template
|
# Get jinja env overrides from template
|
||||||
|
@ -290,8 +288,7 @@ class Templar:
|
||||||
for pair in line.split(','):
|
for pair in line.split(','):
|
||||||
(key,val) = pair.split(':')
|
(key,val) = pair.split(':')
|
||||||
key = key.strip()
|
key = key.strip()
|
||||||
if key in JINJA2_ALLOWED_OVERRIDES:
|
setattr(myenv, key, ast.literal_eval(val.strip()))
|
||||||
setattr(myenv, key, ast.literal_eval(val.strip()))
|
|
||||||
|
|
||||||
#FIXME: add tests
|
#FIXME: add tests
|
||||||
myenv.filters.update(self._get_filters())
|
myenv.filters.update(self._get_filters())
|
||||||
|
|
Loading…
Reference in a new issue