[Zope] tal:attributes question

2005-07-22 Thread Erik Myllymaki

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 | nothingThere was an error/p

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] tal:attributes question

2005-07-22 Thread Fred Drake
On 7/22/05, Erik Myllymaki [EMAIL PROTECTED] 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
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )