[Zope] testing for NULL

Wolfram Kerber wk@gallileus.de
Mon, 3 Dec 2001 06:37:35 +0100


NULL is a missing value ;-)

You could test for it in dtml like so:

<dtml-if "_.repr(ID) == 'Missing.Value'">...

It's a bit fluffy but should give no problems. In python you would write:

import Missing

if ID is Missing.Value:
    do something

To use the above in a PythonScript you need to setup module security, for
instructions on that read /Products/PythonScripts/module_access_examples.py
and then add the following:

ModuleSecurityInfo('Missing').declarePublic('Value')


Wolfram

----- Original Message -----
From: "Trevor Toenjes" <zope@toenjes.com>
To: <zope@zope.org>
Sent: Sunday, December 02, 2001 7:46 AM
Subject: [Zope] testing for NULL


> I am messing with TinyTablePlus which has NULL as the value for one of the
> ID column.
> How do I test for NULL?
>
> <dtml-in expr="testtable.getRows()">
>
> I have tried...
> <dtml-if "ID==''">
> <dtml-if "ID=='Null'">
> <dtml-if "ID==Null">
> <dtml-if "ID==None">
>
> I don't know if NULL is a string, a non-entity or what?
> Thanks,
> Trevor
>
>
> _______________________________________________
> 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 )