kolypto / j2cli

Jinja2 Command-Line Tool, reworked

Home Page:http://pypi.python.org/pypi/j2cli

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

it doesn't loop correctly an environment variable list

marquicus opened this issue · comments

printing the variable with a list works well:

{{ MODEMS }}

...
/dev/ttyUSB12
/dev/ttyUSB8
/dev/ttyUSB4
/dev/ttyUSB1

but looping the variable doesn't work well, it loops each character:

{% for modem in MODEMS: %}
[{{ modem[:-3] }}]
device = {{ modem }}
...
[]
device = /
incoming = yes
...
[]
device = d
...
[]
device = e
incoming = yes
...
[]
device = v
incoming = yes

@marquicus Were you able to fix the issue ?

No with j2cli, cause of time rather I used bash

commented

@marquicus if this is still relevant, will you please show me your template and data? I may be able to assist.

The issue is that your MODEMS should be an array, but it's a string instead. You are probably feeding j2 some wrong data.