Hi,
From the 'Zope Book' the statement
<dtml-if variable> means that 'if the..variable does not exist, then this condition is false'. I found that this is not true. When I tried using dtml-if to a non-existent variable, I got a 'key error'. So how do I check if the variable does not exist ? Tks. AL
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Are you checking for a checkbox? Then you should do (for example), <dtml-if expr="REQUEST.has_key('check_box')"> Checked! </dtml-if> Got this from Jim Penny. I think the Zope book should include this type of situation, if it doesn't already... HTH Russell On Tuesday 05 November 2002 06:46 am, you wrote:
Hi,
From the 'Zope Book' the statement
<dtml-if variable>
means that 'if the..variable does not exist, then this condition is false'.
I found that this is not true. When I tried using dtml-if to a non-existent variable, I got a 'key error'. So how do I check if the variable does not exist ?
Tks.
AL
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
- -- Linux -- the OS for the Renaissance Man -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9x7wbAqKGrvVshJQRAnftAJ41tJW2Kzajy7/dAsBl6G1C2jdAAgCfavsW LVAUiMup6JT54VNYWYk8ESk= =L9dB -----END PGP SIGNATURE-----
Alfredo P. Ricafort wrote:
Hi,
From the 'Zope Book' the statement
means that 'if the..variable does not exist, then this condition is false'.
I found that this is not true. When I tried using dtml-if to a non-existent variable, I got a 'key error'. So how do I check if the variable does not exist ?
Tks.
AL
Are you sure that you did not try: <dtml-if expr="var_name"> Something </dtml> Because it is *not* the same as: <dtml-if var_name> Something </dtml-if> The first example is Python-like in behavior. You get a key error if var_name does not exist. The second example should work even if var_name is not defined AFAIK. \Oliver
I just found out that the error is not due to dtml-if. It was caused by the wrong use of dtml-let. Anyway, thank you guys. AL On Tue, 2002-11-05 at 20:45, Oliver Marx wrote:
Alfredo P. Ricafort wrote:
Hi,
From the 'Zope Book' the statement
means that 'if the..variable does not exist, then this condition is false'.
I found that this is not true. When I tried using dtml-if to a non-existent variable, I got a 'key error'. So how do I check if the variable does not exist ?
Tks.
AL
Are you sure that you did not try:
<dtml-if expr="var_name"> Something </dtml>
Because it is *not* the same as:
<dtml-if var_name> Something </dtml-if>
The first example is Python-like in behavior. You get a key error if var_name does not exist. The second example should work even if var_name is not defined AFAIK.
\Oliver
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
Alfredo P. Ricafort -
Oliver Marx -
Russell Hires