[Zope] tal:attributes question

Fred Drake fdrake at gmail.com
Fri Jul 22 14:40:47 EDT 2005


On 7/22/05, Erik Myllymaki <erik.myllymaki at aviawest.com> wrote:
> I am trying to set the bgcolor of a page based on the existance of a variable.
> 
> Neither of these seem to work:
> 
> <body
>    tal:attributes="bgcolor python:test(hasattr(options, 'error'), 'red', 'green')">

Try this:

    <body
       tal:attributes="bgcolor python:test(options.has_key('error'),
'red', 'green')">


  -Fred

-- 
Fred L. Drake, Jr.    <fdrake at gmail.com>
Zope Corporation


More information about the Zope mailing list