Hi Anand,
in JINJA2 template engine you have additiononal variables inside the loop.
See the
http://jinja.pocoo.org/docs/dev/templates/ and the loop.last.
So your code could be like ...
{% for row in rows %}
{% if not loop.first %}
,
{% endif %}
{{ row }}
{% endfor %}
Peter
On 16/04/15 20:19, Anand Buddhdev wrote:
On 16/04/15 19:50, Jan-Piet Mens wrote:
Quite off-topic for a DNS list, but have you
considered using a Jinja2
`join' filter?
Hi JP,
I do know about the 'join' filter, and use it in some of my templates
already. The issue here is Knot's requirement to name every interface
and remote. With what I need to do, I have to template all the remotes
first, and then remember the name of each remote, and then use that
later in the 'groups' section. My remotes list expands to one or more
addresses depending on various conditions (private addresses, IPv6
addresses, etc). A simple join won't help :(
Ideally, Knot would not have a 'groups' section, but rather, the remotes
section would allow grouping within it, much like BIND's 'masters' macro.
I'm following the development of Knot, and see that it's going to switch
to YAML for version 2. That should allow easier templating, especially
as Knot 2 is also introducing patterns, like NSD4.
Regards,
Anand
_______________________________________________
knot-dns-users mailing list
knot-dns-users(a)lists.nic.cz
https://lists.nic.cz/cgi-bin/mailman/listinfo/knot-dns-users
--
*Peter Hudec*
Infraštruktúrny architekt
phudec(a)cnc.sk <mailto:phduec@cnc.sk>
*CNC, a.s.*
Borská 6, 841 04 Bratislava
Recepcia: +421 2 35 000 100
Mobil:+421 905 997 203
*www.cnc.sk* <http:///www.cnc.sk>