I am trying to set the text color using css in a jinja2 template. In the following code I want to set the output string to print in a specific font color if the variable contains a string. Everytime the template is generated though it prints in red due to the else statement, it never see the first two conditions even though the output should be matched, I can tell what the output from the variable is when the table generates and it is as expected. I know my css is correct due to the printing of the string in red by default.
My first thought was to enclose the string I was checking for in quotes but that didn't work. Next was that jinja was not expanding RepoOutput[RepoName.index(repo)]
but the for loop above it works, RepoName
is expanded upon properly. I know if I add the braces it will print the variable which I am fairly certain will either break the template or just not work.
I tried looking at these sites and went through the list of global expressions as well but couldn't find any examples similar to mine or a direction in which to look further.
http://jinja.pocoo.org/docs/templates/#if
http://wsgiarea.pocoo.org/jinja/docs/conditions.html
{% for repo in RepoName %}
<tr>
<td> <a href="http://mongit201.be.monster.com/icinga/{{ repo }}">{{ repo }}</a> </td>
{% if error in RepoOutput[RepoName.index(repo)] %}
<td id=error> {{ RepoOutput[RepoName.index(repo)] }} </td> <!-- I want this in green if it is up-to-date, otherwise I want it in red -->
{% elif Already in RepoOutput[RepoName.index(repo)] %}
<td id=good> {{ RepoOutput[RepoName.index(repo)] }} </td> <!-- I want this in green if it is up-to-date, otherwise I want it in red -->
{% else %}
<td id=error> {{ RepoOutput[RepoName.index(repo)] }} </td> <!-- I want this in green if it is up-to-date, otherwise I want it in red -->
</tr>
{% endif %}
{% endfor %}
Thanks