2011/1/31 Remco <[email protected]>:
> There seems to be a minor problem with this statement, but I think
> that's a Templetor issue.
>
> The following statement:
> $('email' in tvars and 'value="%s"' % tvars['email'] or '')
> results in:
> value="[email protected]"
>
> The "-signs are translated to HTML-entitie "
> Is there a way to overcome this problem?
Templator escapes the substituted values by default. You can disable
that by using $: instead of $. However, I don't recommend that because
the value can have special characters which can interfere with the
generated html.
I think the right way to solve this is:
$if 'email' in tvars: value="$tvars['email']"
If you need to use the same pattern in multiple places in the
template, then you can make it a function.
$def render_value(tvars, key):
$if key in tvars: value="$tvars[key]"
And call it as:
<input type="text" name="email" $:render_value(tvars, "email) />
Note the : after $. It is required because the value is already
escaped in the function.
Anand
--
You received this message because you are subscribed to the Google Groups
"web.py" 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/webpy?hl=en.