[Zope-dev] urgent: string exceptions

Chris McDonough chrism@zope.com
11 Apr 2003 09:58:18 -0400


You could use ModuleSecurityInfo (see developer's guide) to put this
code in a module and import from the python script.  I'm not sure if
we'd be able to safely expose import of the bad request exception
directly from OFS, this might require some refactoring.

On Fri, 2003-04-11 at 09:13, Christian Theune wrote:
> This won't work within python scripts. Or am I wrong?
> 
> Cheers,
> Christian
> 
> Am Fre, 2003-04-11 um 15.07 schrieb Chris McDonough:
> > You can catch most string exceptions.  "Bad Request" cannot be caught
> > because (afaik) the string isn't interned because it has a space in it.
> > 
> > As a workaround, I'd use except: then do
> > 
> > try:
> >    something
> > except:
> >    e = sys.exc_info()
> >    if e[0] == 'Bad Request':
> >       do something
> >    raise
> > 
> 
> -- 
> Christian Theune, gocept gmbh & co. kg
> http://www.gocept.com - ct@gocept.com
> fon: 03496 3099112 fax: 03496 3099118 mobile: 0179 7808366
>