How is Jinja2's Undefined intended to interact with objects that have
attributes which return None (such as from SQLAlchemy, where a NULL in
the database is translated to None)?  I would expect, based on the
documentation, to be able to write constructs like {% if obj.field is
defined %} or {{ obj.field|d }}.  However, unless I've encountered a
bug, it seems like Jinja2 treats None as a defined value—certainly
counterintuitive!

I can work around this by doing {{ obj.field|d('', true) }}, but that
lacks the simplicity of {{field|d}}, and requires more typing for
every field which may be NULL.

Is Jinja2 working as intended here, or is there something I'm missing?

Thanks,

Kurt

-- 
You received this message because you are subscribed to the Google Groups 
"pocoo-libs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pocoo-libs?hl=en.

Reply via email to