Return "" for unidentified values #25

Closed
wants to merge 1 commit into
from

2 participants

@fauxsoup

Also, switch to lists module. Proplists is pure erlang and thus slower than
the equivalent lists functions.

@fauxsoup fauxsoup Return "" for missing attributes
Also, switch to lists module. Proplists is pure erlang and thus slower than
the equivalent lists functions.
8d24494
@fauxsoup

When a value is NOT found in the parameters passed to the template, erlydtl will insert the atom "undefined" into the IOList in its place. This causes problems with certain filters which expect strings.

@evanmiller

The current behavior is definitely wrong, but I think the proper solution requires more nuance than the proposed patch. We need to throw an error if an undefined variable is evaluated into the template, but just treat it is "false" in the context of "if" expressions and the "default_if_none" filter.

If you submit a patch with just the proplists change I'll get that merged in ASAP, but dealing with undefined values will need larger changes to the compiler.

@fauxsoup fauxsoup closed this May 11, 2012
@fauxsoup

I'll generate another pull request for the proplists to lists update and work on a better solution for the default value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment