[Zope-dev] Re: brain.getObject and traversal

Dieter Maurer dieter at handshake.de
Fri Apr 1 16:00:11 EST 2005


Max M wrote at 2005-3-31 14:48 +0200:
> ...
>Most of my queries, where I need to wake up objects, has the form::
>
>     brains = catalog(portal_type='Document')
>     objects = []
>     for brain in brains:
>         try:
>             obj = brain.getObject()
>             if not obj is None:
>                 objects.append(obj)
>         except:
>             pass
>
>So it will not break any of my code, and I guess that most do something
>similar.

Hopefully not:

   "try: ... except: ..." is a powerful receipe to hide
   problems and to get low quality code.

   They should be used *very* rarely...

-- 
Dieter


More information about the Zope-Dev mailing list