[Zope-Checkins] [Checkins] SVN: Zope/branches/2.12/ Correctly handle unauthorized exceptions in the ZPublisherExceptionHook.

Hanno Schlichting hanno at hannosch.eu
Thu Jul 2 05:43:13 EDT 2009


On Thu, Jul 2, 2009 at 9:51 AM, David Glick<davidglick at onenw.org> wrote:
> I think you need issubclass(t, Unauthorized) here, as it could be the
> Unauthorized from AccessControl.unauthorized which is a subclass of the one
> from zExceptions.

The definition [1] says:

isinstance(object, classinfo)
Return true if the object argument is an instance of the classinfo
argument, or of a (direct or indirect) subclass thereof.

and a short interpreter session confirms:

>>> class A():
...     pass
...
>>> class B(A):
...     pass
...

>>> a = A()
>>> b = B()

>>> isinstance(a, A)
True
>>> isinstance(a, B)
False

>>> isinstance(b, A)
True
>>> isinstance(b, B)
True

[1] http://docs.python.org/library/functions.html


More information about the Zope-Checkins mailing list