Two Unauthorized exceptions, why?

Bug #143503 reported by Jens Vagelpohl
2
Affects Status Importance Assigned to Milestone
Zope 2
Won't Fix
Low
Unassigned

Bug Description

There are two exception classes called Unauthorized defined in Zope: zExceptions.Unauthorized and AccessControl.Unauthorized. The version in AccessControl subclasses from the zExceptions code and overrides one method (getValueName), whereby both implementations attempt to do the same thing slightly differently.

The problem is that both classes are used in Zope without any rhyme or reason, and if you have an except clause you cannot catch zExceptions.Unauthorized by looking for AccessControl.Unauthorized, leading to much head-scratching.

I don't know what the rationale is to override getValueName in AccessControl.Unauthorized (the overridden implementation seems better than the one in zExceptions.Unauthorized), but it seems that AccessControl/unauthorized.py should go away and AccessControl/__init__.py should merely import zExceptions.Unauthorized for backwards compatibility.

Tags: bug zope
Revision history for this message
Jens Vagelpohl (dataflake-deactivatedaccount-deactivatedaccount) wrote :

The standard workaround is to always look for zExceptions.Unauthorized in except clauses.

Changed in zope2:
assignee: nobody → Jens Vagelpohl (jens-dataflake)
importance: Medium → Low
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.