[Zope] Boolean properties ( Zope 2.5)

Lennart Regebro lennart@torped.se
Wed, 4 Sep 2002 17:50:13 +0200


From: "Eron Lloyd" <elloyd@lancaster.lib.pa.us>
> Like Python < 2.2.1, boolean values return integer types 1 (true) or 0
> (false). In the future, Python will provide boolean objects True and
> False. So in a Python script:
>
> if propertyValue == 1:
>     doSomething()
> else:
>     cancelAction()

Yeah, but Zope's boolean properties are not necessarily a Python boolean
value.
They can be set to basically anything. You use them like this:

> if propertyValue:
>     doSomething()
> else:
>     cancelAction()

The "== 1" part will just make the whole thing fail even when the property
box is checked. I think the default "on" value is "on". :-)