Happy New Year to everybody,

I'm working to isolate a core set of ZTK packages which are independent
from Zope and reusable outside the Zope community. One of them is
zope.security, which can be used (and it is useful, indeed) with non-zope
frameworks too.

While doing it, I'm trying to remove dependencies which are zope-specific,
to minimize the overhead for developers who are using the whole zope stack
(like me :)).

zope.security depends on zope.exceptions because it imports this symbol in

    from zope.exceptions import DuplicationError

zope.exceptions defines DuplicationError as:

    class IDuplicationError(Interface):

    class DuplicationError(Exception):
        """A duplicate registration was attempted"""

The zope.exceptions package contains "exception interfaces and
implementations which are so general purpose that they don't belong in Zope
application-specific packages.", as stated by the README.

I propose to make the remove the dependency between zope.security and
zope.exceptions with a conditional import:

 * if zope.exceptions is available, use DuplicationError from it;

 * if it is not available, define a zope.security-specific DuplicationError
   (which inherits from ValueError, maybe).

As using zope.exceptions only make sense if you are checking the exception
type importing its interface from the zope.exceptions package, and thus
depending on it, I see no risk in such a change.

Thoughts? Comments?

Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to