[Zope] What If It Doesn't Have a Key?

Martijn Pieters mj at zopatista.com
Mon Aug 13 14:27:04 EDT 2007


On 8/13/07, tonylabarbara at aol.com <tonylabarbara at aol.com> wrote:
>  I have this line of code:
>  <span tal:condition="python:request.has_key('checkbox_1')" tal:omit-tag="">

Better written as <tal:block condition="exists:request/checkbox_1">

>  I would like to do the exact opposite of that. In other words, have the
> condition render if checkbox_1 does not exist. How do I do that?

Either use a 'not' in your python expression ("python:not
request.has_key") or use the not: tales modifier:

  <tal:block condition="not:exists:request/checkbox_1">

-- 
Martijn Pieters


More information about the Zope mailing list