What If It Doesn't Have a Key?
Hi; I have this line of code: <span tal:condition="python:request.has_key('checkbox_1')" tal:omit-tag=""> 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? TIA, Tony ________________________________________________________________________ AOL now offers free email to everyone. Find out more about what's free from AOL at AOL.com.
--On 13. August 2007 12:36:13 -0400 tonylabarbara@aol.com wrote:
Hi; I have this line of code: <span tal:condition="python:request.has_key('checkbox_1')" tal:omit-tag=""> 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? TIA, Tony
Look at the 'not:' directive. -aj
Oh <;) Thanks. Tony -----Original Message----- From: Andreas Jung <lists@zopyx.com> To: tonylabarbara@aol.com; zope@zope.org Sent: Mon, 13 Aug 2007 12:47 pm Subject: Re: [Zope] What If It Doesn't Have a Key? ? --On 13. August 2007 12:36:13 -0400 tonylabarbara@aol.com wrote:? ?
Hi;? I have this line of code:? <span tal:condition="python:request.has_key('checkbox_1')"? tal:omit-tag=""> 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? TIA,? Tony? ? ? Look at the 'not:' directive.? ? -aj?
________________________________________________________________________ AOL now offers free email to everyone. Find out more about what's free from AOL at AOL.com.
On 8/13/07, tonylabarbara@aol.com <tonylabarbara@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
participants (3)
-
Andreas Jung -
Martijn Pieters -
tonylabarbara@aol.com