[Zope-CMF] Re: [dev] Unauthorized confusion and Zope 2.4 compatibility

Tres Seaver tseaver at zope.com
Mon Jan 5 16:12:16 EST 2004


Yuppie wrote:
> Hi!
> 
> 
> Zope has two different Unauthorized exceptions: 
> AccessControl.Unauthorized is a subclass of zExceptions.Unauthorized. 
> The usage of the two exceptions is more or less random.
> 
> See also this mail and thread: 
> <http://mail.zope.org/pipermail/zope-coders/2003-November/004346.html>
> 
> This issue isn't resolved in Zope, but even if it would be resolved in 
> Zope 2.7 we have to find a solution that works with older Zope versions.
> 
> 
> I propose to use zExceptions.Unauthorized to catch Unauthorized (catches 
> both) and AccessControl.Unauthorized to raise Unauthorized (can be 
> catched by both).

+0:  it is ugly, and a bug magnet, but may be the best we can do.  Any 
place where we catch that should use the fully-qualified name, and 
include a comment so that others don't remove inadvertently.  E.g.::

    try:
      # something which might raise one of the Unauthorized's
    except zExceptions.Unauthorized:  # XXX:  catch all Unauth!
      # handle it somehow

> CMFCoreExceptions.CMFUnauthorizedError is already a subclass of 
> AccessControl.Unauthorized and could be used to raise Unauthorized.

+1

> CMFCoreExceptions.Unauthorized could become an alias of 
> zExceptions.Unauthorized.

-1:  I'd rather ditch it altogether;  the alias is likely to cause 
confusion.

> Any better ideas?
> 
> 
> The issue becomes more complicated if we try to be Zope 2.4 compatible: 
> In Zope 2.4 zExceptions.Unauthorized didn't exist and 
> AccessControl.Unauthorized was a string exception.
> 
> Is there any good reason to maintain Zope 2.4 compatibility?

No, especially not to support brokenness like string exceptions.

> 
> INSTALL.txt says:
> 
>   Requirements
>     - Zope v. 2.5 and later
>       o Note:  Zope v. 2.4.3 *may* work, but is no longer a supported
>         version.
> 
> I don't like to care any longer about Zope 2.4. I propose to remove that 
> note and import zExceptions.Unauthorized without handling an ImportError.

+1 for the head;  we should leave the tenuous support on the released 
branches (even CMF 1.3 required a late 2.4 with added products).

Tres.
-- 
===============================================================
Tres Seaver                                tseaver at zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com




More information about the Zope-CMF mailing list