title: jinja2 string comparison when one value is null?
body: <p>Jinja2 template code:</p>
  
  <pre><code>{% if u.user_name == u.user_email %}
   {{ u.user_email }}
  {% else %}
   {{ u.user_name }}&lt;br /&gt;
   {{ u.user_email }}
  {% endif %}
  </code></pre>
  
  <p>Usually the data source sets the user_name field to user_email if there is no separate name. However, sometimes there is nothing defined for the user_name field at all. </p>
  
  <p>The problem is that in the Jinja2 code above, if the user_name field is undefined / null, the test above evaluates to false and both lines get spit out — one of which is blank. </p>
  
  <p>I'm not sure how to properly write this test syntax. I've read the documentation and have tried approaches like <a href="https://stackoverflow.com/questions/19161093/convert-integer-to-string-jinja">Convert integer to string Jinja</a> and <a href="https://stackoverflow.com/questions/12623768/compare-two-variables-in-jinja2-template/12629325#12629325">compare two variables in jinja2 template</a>. I guess I have a problem with data types, I'm just not sure how to write this syntax so that it works.</p>
  
  <p>Any help is appreciated!</p>