[Zope] tal:attributes question

Erik Myllymaki erik.myllymaki at aviawest.com
Fri Jul 22 13:44:54 EDT 2005


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')">

<body
   tal:attributes="bgcolor python:test(hasattr(request, 'error'), 'red', 'green')">

I can access the error variable with this:

<p class="error" tal:condition="exists: options/error" 
tal:content="options/error | nothing">There was an error</p>


More information about the Zope mailing list