[Zope] using getProperty and catching Unauthorized

Casey Duncan casey@zope.com
Fri, 25 Oct 2002 16:39:57 -0400


Yes, but as of right now, Python strings that do not contain spaces are interned as the same object. So as long as the name does not have a space in it, it should work.

That said, string exceptions suck rocks. But string exceptions with spaces suck gravel ;^)

-Casey

On Fri, 25 Oct 2002 21:37:53 +0200
Dieter Maurer <dieter@handshake.de> wrote:

> Casey Duncan writes:
>  > I think the following should do what you want:
>  > 
>  > for foo in bar.objectvalues()
>  >     try:
>  >         mo = foo.getProperty('menu_order', None)
>  >     except 'Unauthorized':
>  >         continue
>  >     ..do stuff..
> It may not work, because Python uses "is" to check against string
> exceptions and not "==".
> 
> 
> Dieter