[Zope3-checkins] SVN: Zope3/branches/jim-adapter/src/zope/ More on MakeZopeAppSmaller:

Philipp von Weitershausen philikon at philikon.de
Tue Apr 4 04:46:13 EDT 2006


Log message for revision 66372:
  More on MakeZopeAppSmaller:
  * Move UserError to zope.exceptions. (While at it, restructure zope.exceptions
    a little bit).
  

Changed:
  U   Zope3/branches/jim-adapter/src/zope/app/authentication/browser/ftests.py
  U   Zope3/branches/jim-adapter/src/zope/app/authentication/idpicker.py
  U   Zope3/branches/jim-adapter/src/zope/app/component/browser/__init__.py
  U   Zope3/branches/jim-adapter/src/zope/app/component/browser/tools.py
  U   Zope3/branches/jim-adapter/src/zope/app/container/browser/adding.py
  U   Zope3/branches/jim-adapter/src/zope/app/container/browser/contents.py
  U   Zope3/branches/jim-adapter/src/zope/app/container/browser/tests/test_adding.py
  U   Zope3/branches/jim-adapter/src/zope/app/container/contained.py
  U   Zope3/branches/jim-adapter/src/zope/app/dependable/interfaces.py
  U   Zope3/branches/jim-adapter/src/zope/app/exception/browser/configure.zcml
  U   Zope3/branches/jim-adapter/src/zope/app/exception/interfaces.py
  U   Zope3/branches/jim-adapter/src/zope/app/file/browser/file.py
  U   Zope3/branches/jim-adapter/src/zope/app/form/interfaces.py
  U   Zope3/branches/jim-adapter/src/zope/app/securitypolicy/browser/rolepermissionview.py
  U   Zope3/branches/jim-adapter/src/zope/app/securitypolicy/browser/tests/test_rolepermissionview.py
  U   Zope3/branches/jim-adapter/src/zope/app/sqlexpr/sqlexpr.py
  U   Zope3/branches/jim-adapter/src/zope/app/zapi/__init__.py
  U   Zope3/branches/jim-adapter/src/zope/exceptions/__init__.py
  D   Zope3/branches/jim-adapter/src/zope/exceptions/_duplicate.py
  U   Zope3/branches/jim-adapter/src/zope/exceptions/interfaces.py

-=-
Modified: Zope3/branches/jim-adapter/src/zope/app/authentication/browser/ftests.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/authentication/browser/ftests.py	2006-04-04 08:44:37 UTC (rev 66371)
+++ Zope3/branches/jim-adapter/src/zope/app/authentication/browser/ftests.py	2006-04-04 08:46:11 UTC (rev 66372)
@@ -16,22 +16,18 @@
 $Id$
 """
 import unittest
-
-from zope.app.testing import ztapi
-from zope.app.testing import functional
-
 import transaction
 
 from zope.interface import implements, Interface, directlyProvides
-from zope.app import copypastemove
+from zope.exceptions.interfaces import UserError
 
+from zope.app import copypastemove
+from zope.app.testing import ztapi
+from zope.app.testing import functional
 from zope.app.authentication.principalfolder import PrincipalFolder
 from zope.app.authentication.principalfolder import Principal
 from zope.app.authentication.principalfolder import IInternalPrincipal
 
-from zope.app.exception.interfaces import UserError
-
-
 class FunkTest(functional.BrowserTestCase):
 
     def test_copypaste_duplicated_id_object(self):

Modified: Zope3/branches/jim-adapter/src/zope/app/authentication/idpicker.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/authentication/idpicker.py	2006-04-04 08:44:37 UTC (rev 66371)
+++ Zope3/branches/jim-adapter/src/zope/app/authentication/idpicker.py	2006-04-04 08:46:11 UTC (rev 66372)
@@ -15,11 +15,10 @@
 
 $Id$
 """
-
+import re
+from zope.exceptions.interfaces import UserError
 from zope.app.container.contained import NameChooser
-from zope.app.exception.interfaces import UserError
 from zope.app.i18n import ZopeMessageFactory as _
-import re
 
 ok = re.compile('[!-~]+$').match
 class IdPicker(NameChooser):

Modified: Zope3/branches/jim-adapter/src/zope/app/component/browser/__init__.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/component/browser/__init__.py	2006-04-04 08:44:37 UTC (rev 66371)
+++ Zope3/branches/jim-adapter/src/zope/app/component/browser/__init__.py	2006-04-04 08:46:11 UTC (rev 66372)
@@ -15,6 +15,7 @@
 
 $Id$
 """
+from zope.exceptions.interfaces import UserError
 from zope.security.proxy import removeSecurityProxy
 from zope.app import zapi
 from zope.app.container.browser.adding import Adding
@@ -156,7 +157,7 @@
 
         """
         if ISite.providedBy(self.context):
-            raise zapi.UserError('This is already a site')
+            raise UserError('This is already a site')
 
         # We don't want to store security proxies (we can't,
         # actually), so we have to remove proxies here before passing

Modified: Zope3/branches/jim-adapter/src/zope/app/component/browser/tools.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/component/browser/tools.py	2006-04-04 08:44:37 UTC (rev 66371)
+++ Zope3/branches/jim-adapter/src/zope/app/component/browser/tools.py	2006-04-04 08:46:11 UTC (rev 66372)
@@ -17,12 +17,11 @@
 """
 import zope.interface
 import zope.event
+from zope.exceptions.interfaces import UserError
 
 from zope.app import zapi
 from zope.app.component import site, interfaces, browser
 from zope.app.event import objectevent
-from zope.app.exception.interfaces import UserError
-
 from zope.app.i18n import ZopeMessageFactory as _
 
 

Modified: Zope3/branches/jim-adapter/src/zope/app/container/browser/adding.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/container/browser/adding.py	2006-04-04 08:44:37 UTC (rev 66371)
+++ Zope3/branches/jim-adapter/src/zope/app/container/browser/adding.py	2006-04-04 08:46:11 UTC (rev 66372)
@@ -27,8 +27,8 @@
 from zope.interface import implements
 from zope.publisher.interfaces import IPublishTraverse
 from zope.security.proxy import removeSecurityProxy
+from zope.exceptions.interfaces import UserError
 
-from zope.app.exception.interfaces import UserError
 from zope.app.container.interfaces import IAdding, INameChooser
 from zope.app.container.interfaces import IContainerNamesContainer
 from zope.app.container.constraints import checkFactory, checkObject

Modified: Zope3/branches/jim-adapter/src/zope/app/container/browser/contents.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/container/browser/contents.py	2006-04-04 08:44:37 UTC (rev 66371)
+++ Zope3/branches/jim-adapter/src/zope/app/container/browser/contents.py	2006-04-04 08:46:11 UTC (rev 66372)
@@ -19,13 +19,13 @@
 
 import urllib
 
-from zope.app.exception.interfaces import UserError
-from zope.app.traversing.interfaces import TraversalError
+from zope.exceptions.interfaces import UserError
 from zope.security.interfaces import Unauthorized
 from zope.security import canWrite
 from zope.size.interfaces import ISized
 
 from zope.app import zapi
+from zope.app.traversing.interfaces import TraversalError
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 from zope.app.publisher.browser import BrowserView
 from zope.app.i18n import ZopeMessageFactory as _

Modified: Zope3/branches/jim-adapter/src/zope/app/container/browser/tests/test_adding.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/container/browser/tests/test_adding.py	2006-04-04 08:44:37 UTC (rev 66371)
+++ Zope3/branches/jim-adapter/src/zope/app/container/browser/tests/test_adding.py	2006-04-04 08:46:11 UTC (rev 66372)
@@ -26,6 +26,7 @@
 from zope.publisher.interfaces.browser import IBrowserRequest
 from zope.security.interfaces import ForbiddenAttribute
 from zope.testing.doctestunit import DocTestSuite
+from zope.exceptions.interfaces import UserError
 
 from zope.app import zapi
 from zope.app.testing import ztapi
@@ -33,7 +34,6 @@
 from zope.app.traversing.browser import AbsoluteURL
 from zope.app.traversing.browser.interfaces import IAbsoluteURL
 from zope.app.traversing.interfaces import IContainmentRoot
-from zope.app.exception.interfaces import UserError
 from zope.app.publisher.browser import BrowserView
 from zope.app.publisher.interfaces.browser import AddMenu
 from zope.app.publisher.interfaces.browser import IMenuItemType, IBrowserMenu

Modified: Zope3/branches/jim-adapter/src/zope/app/container/contained.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/container/contained.py	2006-04-04 08:44:37 UTC (rev 66371)
+++ Zope3/branches/jim-adapter/src/zope/app/container/contained.py	2006-04-04 08:46:11 UTC (rev 66372)
@@ -17,7 +17,7 @@
 """
 __docformat__ = 'restructuredtext'
 
-from zope.exceptions import DuplicationError
+from zope.exceptions.interfaces import DuplicationError, UserError
 from zope.security.checker import selectChecker, CombinedChecker
 
 import zope.interface.declarations
@@ -26,7 +26,6 @@
 from zope.interface import providedBy
 
 from zope.app import zapi
-from zope.app.exception.interfaces import UserError
 from zope.component.interfaces import ObjectEvent
 from zope.app.event.objectevent import ObjectModifiedEvent
 from zope.event import notify

Modified: Zope3/branches/jim-adapter/src/zope/app/dependable/interfaces.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/dependable/interfaces.py	2006-04-04 08:44:37 UTC (rev 66371)
+++ Zope3/branches/jim-adapter/src/zope/app/dependable/interfaces.py	2006-04-04 08:46:11 UTC (rev 66372)
@@ -18,7 +18,7 @@
 __docformat__ = 'restructuredtext'
 
 from zope.interface import Interface
-from zope.app.exception.interfaces import UserError
+from zope.exceptions.interfaces import UserError
 
 class IDependable(Interface):
     """Objects that other objects depend on.

Modified: Zope3/branches/jim-adapter/src/zope/app/exception/browser/configure.zcml
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/exception/browser/configure.zcml	2006-04-04 08:44:37 UTC (rev 66371)
+++ Zope3/branches/jim-adapter/src/zope/app/exception/browser/configure.zcml	2006-04-04 08:46:11 UTC (rev 66372)
@@ -28,7 +28,7 @@
   <zope:adapter factory=".unauthorized.default_template" name="default" />
 
   <page
-      for="zope.app.exception.interfaces.IUserError"
+      for="zope.exceptions.interfaces.IUserError"
       name="index.html"
       permission="zope.Public"
       template="user.pt"

Modified: Zope3/branches/jim-adapter/src/zope/app/exception/interfaces.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/exception/interfaces.py	2006-04-04 08:44:37 UTC (rev 66371)
+++ Zope3/branches/jim-adapter/src/zope/app/exception/interfaces.py	2006-04-04 08:46:11 UTC (rev 66372)
@@ -17,17 +17,19 @@
 
 from zope.interface import Interface, implements
 
-class IUserError(Interface):
-    """User error exceptions
-    """
+##############################################################################
+# BBB 2006/04/03 - to be removed after 12 months
 
-class UserError(Exception):
-    """User errors
+import zope.deferredimport
+zope.deferredimport.deprecated(
+    "UserError has been moved to zope.exceptions.interfaces. This "
+    "reference will be removed in Zope 3.5.",
+    UserError = 'zope.exceptions.interfaces:UserError',
+    IUserError = 'zope.exceptions.interfaces:IUserError',
+    )
 
-    These exceptions should generally be displayed to users unless
-    they are handled.
-    """
-    implements(IUserError)
+#
+##############################################################################
 
 class ISystemErrorView(Interface):
     """Error views that can classify their contexts as system errors
@@ -36,4 +38,3 @@
     def isSystemError():
         """Return a boolean indicating whether the error is a system errror
         """
-    

Modified: Zope3/branches/jim-adapter/src/zope/app/file/browser/file.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/file/browser/file.py	2006-04-04 08:44:37 UTC (rev 66371)
+++ Zope3/branches/jim-adapter/src/zope/app/file/browser/file.py	2006-04-04 08:46:11 UTC (rev 66372)
@@ -15,19 +15,18 @@
 
 $Id$
 """
-
 from datetime import datetime
 
 import zope.event
-
 from zope.publisher import contenttype
 from zope.schema import Text
+from zope.exceptions.interfaces import UserError
+
 from zope.app import contenttypes
 from zope.app.event import objectevent
 from zope.app.file.file import File
 from zope.app.file.interfaces import IFile
 from zope.app.i18n import ZopeMessageFactory as _
-from zope.app.exception.interfaces import UserError
 
 __docformat__ = 'restructuredtext'
 

Modified: Zope3/branches/jim-adapter/src/zope/app/form/interfaces.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/form/interfaces.py	2006-04-04 08:44:37 UTC (rev 66371)
+++ Zope3/branches/jim-adapter/src/zope/app/form/interfaces.py	2006-04-04 08:46:11 UTC (rev 66372)
@@ -21,7 +21,7 @@
 from zope.component.interfaces import IView
 from zope.interface import Attribute, Interface, implements
 from zope.schema import Bool
-from zope.app.exception.interfaces import UserError
+from zope.exceptions.interfaces import UserError
 
 class IWidgetInputError(Interface):
     """Placeholder for a snippet View"""

Modified: Zope3/branches/jim-adapter/src/zope/app/securitypolicy/browser/rolepermissionview.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/securitypolicy/browser/rolepermissionview.py	2006-04-04 08:44:37 UTC (rev 66371)
+++ Zope3/branches/jim-adapter/src/zope/app/securitypolicy/browser/rolepermissionview.py	2006-04-04 08:46:11 UTC (rev 66372)
@@ -19,9 +19,9 @@
 
 from zope.i18n import translate
 from zope.interface import implements
+from zope.exceptions.interfaces import UserError
 
 from zope.app import zapi
-from zope.app.exception.interfaces import UserError
 from zope.app.i18n import ZopeMessageFactory as _
 from zope.app.security.settings import Unset, Allow, Deny
 from zope.app.security.interfaces import IPermission

Modified: Zope3/branches/jim-adapter/src/zope/app/securitypolicy/browser/tests/test_rolepermissionview.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/securitypolicy/browser/tests/test_rolepermissionview.py	2006-04-04 08:44:37 UTC (rev 66371)
+++ Zope3/branches/jim-adapter/src/zope/app/securitypolicy/browser/tests/test_rolepermissionview.py	2006-04-04 08:46:11 UTC (rev 66372)
@@ -21,8 +21,8 @@
 from zope.i18n.interfaces import ITranslationDomain
 from zope.i18nmessageid import Message
 from zope.publisher.browser import TestRequest
+from zope.exceptions.interfaces import UserError
 
-from zope.app.exception.interfaces import UserError
 from zope.app.publisher.browser import BrowserView
 from zope.app.testing import ztapi
 from zope.app.security.permission import Permission

Modified: Zope3/branches/jim-adapter/src/zope/app/sqlexpr/sqlexpr.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/sqlexpr/sqlexpr.py	2006-04-04 08:44:37 UTC (rev 66371)
+++ Zope3/branches/jim-adapter/src/zope/app/sqlexpr/sqlexpr.py	2006-04-04 08:46:11 UTC (rev 66372)
@@ -19,8 +19,9 @@
 from zope.interface import implements
 from zope.tales.interfaces import ITALESExpression
 from zope.tales.expressions import StringExpr
+from zope.exceptions.interfaces import UserError 
+
 from zope.app import zapi
-from zope.app.exception.interfaces import UserError 
 from zope.app.rdb import queryForResults
 from zope.app.rdb.interfaces import IZopeDatabaseAdapter, IZopeConnection
 

Modified: Zope3/branches/jim-adapter/src/zope/app/zapi/__init__.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/app/zapi/__init__.py	2006-04-04 08:44:37 UTC (rev 66371)
+++ Zope3/branches/jim-adapter/src/zope/app/zapi/__init__.py	2006-04-04 08:46:11 UTC (rev 66372)
@@ -33,7 +33,7 @@
 from zope.app.publisher.browser import queryDefaultViewName
 from zope.app.traversing.api import *
 from zope.app.traversing.browser.absoluteurl import absoluteURL
-from zope.app.exception.interfaces import UserError
+from zope.exceptions.interfaces import UserError
 
 name = getName
 

Modified: Zope3/branches/jim-adapter/src/zope/exceptions/__init__.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/exceptions/__init__.py	2006-04-04 08:44:37 UTC (rev 66371)
+++ Zope3/branches/jim-adapter/src/zope/exceptions/__init__.py	2006-04-04 08:46:11 UTC (rev 66372)
@@ -18,9 +18,7 @@
 
 $Id$
 """
-
 import zope.deprecation
-
 zope.deprecation.deprecated('INotFoundError',
                             'This interface has been deprecated. '
                             'Use standard interface instead '
@@ -37,10 +35,9 @@
 from zope.exceptions._notfounderror import NotFoundError, INotFoundError
 zope.deprecation.__show__.on()
 
-from zope.exceptions._duplicate import DuplicationError, IDuplicationError
+from zope.exceptions.interfaces import DuplicationError, IDuplicationError
+from zope.exceptions.interfaces import UserError, IUserError
 
-# Importing these interfaces from here is deprecated!
-
 # avoid depency on zope.security:
 try:
     import zope.security

Deleted: Zope3/branches/jim-adapter/src/zope/exceptions/_duplicate.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/exceptions/_duplicate.py	2006-04-04 08:44:37 UTC (rev 66371)
+++ Zope3/branches/jim-adapter/src/zope/exceptions/_duplicate.py	2006-04-04 08:46:11 UTC (rev 66372)
@@ -1,25 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Duplication Error
-
-$Id$
-"""
-from zope.interface import implements, Interface
-
-class IDuplicationError(Interface):
-    pass
-
-class DuplicationError(Exception):
-    """A duplicate registration was attempted"""
-    implements(IDuplicationError)

Modified: Zope3/branches/jim-adapter/src/zope/exceptions/interfaces.py
===================================================================
--- Zope3/branches/jim-adapter/src/zope/exceptions/interfaces.py	2006-04-04 08:44:37 UTC (rev 66371)
+++ Zope3/branches/jim-adapter/src/zope/exceptions/interfaces.py	2006-04-04 08:46:11 UTC (rev 66372)
@@ -15,10 +15,27 @@
 
 $Id$
 """
+from zope.interface import Interface, Attribute, implements
 
+class IDuplicationError(Interface):
+    pass
 
-from zope.interface import Interface, Attribute
+class DuplicationError(Exception):
+    """A duplicate registration was attempted"""
+    implements(IDuplicationError)
 
+class IUserError(Interface):
+    """User error exceptions
+    """
+
+class UserError(Exception):
+    """User errors
+
+    These exceptions should generally be displayed to users unless
+    they are handled.
+    """
+    implements(IUserError)
+
 class ITracebackSupplement(Interface):
     """Provides valuable information to supplement an exception traceback.
 



More information about the Zope3-Checkins mailing list