@app.template_filter('startswith')
def starts_with(field):
if field.startswith("i-"):
return True
return False {% for field in row %}
{% if {{ field | startswith }} %}
<td><a href="{{ url_for('munin') }}">{{ field | table_field | safe }}</a></td>
{% else %}
<td>{{ field | table_field | safe}}</td>
{% endif %}
{% endfor %}
{% for field in row %}
{% if field[:2] == 'i-' %}
<td><a href="{{ url_for('munin') }}">{{ field | table_field | safe }}</a></td>
{% else %}
<td>{{ field | table_field | safe}}</td>
{% endif %}
{% endfor %}I don't quite understand where the distinctions are between python and jinja, but in this case they are the same.
We use this sort of statement all the time in our jinja templates:
{% if pillar['somekey'].startswith('foo') %}
Hope that helps,
Nicholas
--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.However, when I change that if to something stupid or delete it, page works (of course without effect)