[Zope-DB] Test for equality to Missing.Value (empty field)?

Jeff Kowalczyk jtk@yahoo.com
Mon, 25 Nov 2002 11:46:26 -0500


How can I include the ZSQLMethod result's representation of an empty/null field value in a
two- or threeway equality test in python? My immediate need is to check in a tal:condition
that two fields are equal and yet not null, on results returned from Win32 Zope 2.5.1
Win32 ODBC connection to SQL Server 2000. Here's my test-harness element:

<span tal:condition="python:test
(shipment.ChargeAsBilled==shipment.ChargeAsPaid)"
  tal:content="python:repr(shipment.ChargeAsPaid)"
  tal:attributes="style string:color=green"></span>

where shipment is a repeat variable (row) for the shipments results returned by an earlier
define;
shipments python:container.sqlGetShipments();

and repr(shipment.ChargeAsPaid) displays 'Missing.Value' when both Charge fields are Null
in the database.

naive attempts using
(shipment.ChargeAsBilled==shipment.ChargeAsPaid<>getattr(shipment,Missing.Value))
~or~
(shipment.ChargeAsBilled==shipment.ChargeAsPaid<>shipment.Missing.Value)
are attribute errors, as expected.

After I find out how to test both for non-null-ness, I will have the content display
'paid'. I guess the question for me is what is Missing.Value and attribute of, and why
does it have a dot in its name, or is 'Value' an attribute of 'Missing'?

Thanks.