[Zope] Bare except clause in respect to self.DestinationURL()

Andreas Jung lists at zopyx.com
Sat Oct 13 15:33:52 EDT 2007

--On 13. Oktober 2007 21:30:05 +0200 Sascha Welter <zopelist at betabug.ch> 

> Hello Zopistas!
> This pattern here is very common in many people's Zope products:
>     try: u=self.DestinationURL()
>     except: u=REQUEST['URL1']

All those people should burn ...

> It's usually in the manage_addXY() method, when all the work is done, we
> test for REQUEST!=None and we want to know where to redirect to.
> Is there a reason for that bare except here? Wouldn't
> except AttributeError: ... do the job just as well?

Basically yes - unless the method being called might raise other
errors as well.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20071013/c8135aeb/attachment.bin

More information about the Zope mailing list