[Zope] Re: Preserving Context

Suresh V suresh_vv at yahoo.com
Tue Dec 12 11:11:33 EST 2006


Javier Subervi wrote:

> 
> <div align="center" tal:condition="here/hasSearchEngine(mycontext)">

And where is mycontext defined? You will need a tal:define="mycontext 
here" or something.

> 
> I tested the following script with "mycontext" as a passed parameter:
> 
> return 0
> 
> catalog = ''
> try:
>     catalog = getattr(mycontext, mycontext.superValues('ZCatalog')[0].id)
> except:
>     pass
>    

"Bare" except? You bad boy!

Use except AttributeError:

In fact remove the try/except and study the trace output.

Suresh



More information about the Zope mailing list