[Zope] Python Scripts

Chris Withers chrisw@nipltd.com
Mon, 28 May 2001 18:53:47 +0100


> What was wrong with
> if hasattr(context,'coffeebreak'):
>     print "have coffee"
> ?
>
> This is almost the equivalent of DTML's
> <dtml-if coffeebreak>

Not really... the DTML equivalent would be:
<dtml-if "hasattr(context,'coffeebreak')">
...which is something quite different ;-)

In a python script, bind the namespace to _ on the bindings tab and then see
what happens with:

if _['coffeebreak']:
  print 'coffee'

cheers,

Chris