Skip to content
Snippets Groups Projects
Commit 4095c0cd authored by Karl-Hermann Wieners's avatar Karl-Hermann Wieners
Browse files

mkexp: changed 'list' filter replacement to use original filter for iterables

parent 8b91692a
No related branches found
No related tags found
No related merge requests found
......@@ -347,9 +347,10 @@ template_env.filters['split'] = lambda x, s, m=-1: x.split(s, m)
template_env.filters['filter'] = lambda x, f=None: filter(f, x)
# - Replace 'list' handling simple values and strings as singleton lists
def list_singleton(x):
list_original = template_env.filters['list']
def list_singleton(x, *args, **kwargs):
if '__iter__' in dir(x):
return list(x)
return list_original(x, *args, **kwargs)
return [x]
template_env.filters['list'] = list_singleton
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment