[Checkins] SVN: z3c.layer.pagelet/trunk/ - Removed dependency on ``zope.app.exception`` by using a current

Michael Howitz mh at gocept.com
Mon May 25 15:16:17 EDT 2009


Log message for revision 100371:
  - Removed dependency on ``zope.app.exception`` by using a current
    version of ``zope.browser`` and by implementing the exception view
    classes directly instead of inheriting them (Quite nothing of the
    base classes was in use here.)
  
  

Changed:
  U   z3c.layer.pagelet/trunk/CHANGES.txt
  U   z3c.layer.pagelet/trunk/buildout.cfg
  U   z3c.layer.pagelet/trunk/setup.py
  U   z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/README.txt
  U   z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/browser/__init__.py
  U   z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/tests/__init__.py

-=-
Modified: z3c.layer.pagelet/trunk/CHANGES.txt
===================================================================
--- z3c.layer.pagelet/trunk/CHANGES.txt	2009-05-25 19:15:22 UTC (rev 100370)
+++ z3c.layer.pagelet/trunk/CHANGES.txt	2009-05-25 19:16:17 UTC (rev 100371)
@@ -5,6 +5,11 @@
 1.4.1 (unreleased)
 ------------------
 
+- Removed dependency on ``zope.app.exception`` by using a current
+  version of ``zope.browser`` and by implementing the exception view
+  classes directly instead of inheriting them (Quite nothing of the
+  base classes was in use here.)
+
 - Removed not necessary test dependency on ``zope.app.twisted``.
 
 

Modified: z3c.layer.pagelet/trunk/buildout.cfg
===================================================================
--- z3c.layer.pagelet/trunk/buildout.cfg	2009-05-25 19:15:22 UTC (rev 100370)
+++ z3c.layer.pagelet/trunk/buildout.cfg	2009-05-25 19:16:17 UTC (rev 100371)
@@ -1,6 +1,5 @@
 [buildout]
 develop = .
-          ../zope.app.exception
 parts = test checker coverage-test coverage-report
 
 [test]

Modified: z3c.layer.pagelet/trunk/setup.py
===================================================================
--- z3c.layer.pagelet/trunk/setup.py	2009-05-25 19:15:22 UTC (rev 100370)
+++ z3c.layer.pagelet/trunk/setup.py	2009-05-25 19:16:17 UTC (rev 100371)
@@ -64,17 +64,18 @@
             'zope.configuration>=3.5.0',
             'zope.component',
             'zope.app.component',
+            'zope.app.authentication',
             ],
         ),
     install_requires = [
         'setuptools',
+        'z3c.pagelet',
+        'zope.app.publisher',
+        'zope.authentication',
+        'zope.browser>=1.2',
         'zope.configuration',
         'zope.traversing',
-        'zope.app.publisher',
-        'zope.app.exception',
-        'z3c.pagelet',
         'zope.viewlet',
-        'zope.authentication',
         ],
     zip_safe = False,
 )

Modified: z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/README.txt
===================================================================
--- z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/README.txt	2009-05-25 19:15:22 UTC (rev 100370)
+++ z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/README.txt	2009-05-25 19:16:17 UTC (rev 100371)
@@ -67,6 +67,9 @@
   </html>
   <BLANKLINE>
 
+Not Found
+~~~~~~~~~
+
 Now check the not found page which is a exception view on the exception
 ``zope.publisher.interfaces.INotFound``:
 
@@ -109,6 +112,9 @@
   </html>
   <BLANKLINE>
 
+User error
+~~~~~~~~~~
+
 And check the user error page which is a view registred for
 ``zope.exceptions.interfaces.IUserError`` exceptions:
 
@@ -128,6 +134,9 @@
   </html>
   <BLANKLINE>
 
+Common exception (system error)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
 And check error view registred for
 ``zope.interface.common.interfaces.IException``:
 
@@ -154,6 +163,9 @@
   </html>
   <BLANKLINE>
 
+Unauthorized
+~~~~~~~~~~~~
+
 To check the ``zope.security.interfaces.IUnauthorized`` view, we use a
 new unregistred user (test browser). As we have defined an
 unauthenticatedPrincipal in ZCML (see tests/ftesting.zcml) ``401

Modified: z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/browser/__init__.py
===================================================================
--- z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/browser/__init__.py	2009-05-25 19:15:22 UTC (rev 100370)
+++ z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/browser/__init__.py	2009-05-25 19:16:17 UTC (rev 100371)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2007 Zope Foundation and Contributors.
+# Copyright (c) 2007-2009 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -15,21 +15,24 @@
 $Id: __init__.py 97 2007-03-29 22:58:27Z rineichen $
 """
 
+import z3c.pagelet.browser
+import z3c.template.interfaces
+import zope.authentication.interfaces
+import zope.browser.interfaces
 import zope.component
-from zope.app.exception.systemerror import SystemErrorView
-from zope.app.exception.browser.unauthorized import Unauthorized
-from zope.app.exception.browser.user import UserErrorView
-from zope.app.exception.browser.notfound import NotFound
-from zope.authentication.interfaces import IAuthentication
-from z3c.template.interfaces import IContentTemplate
-from z3c.pagelet import browser
+import zope.interface
 
 
-class SystemErrorPagelet(browser.BrowserPagelet, SystemErrorView):
+class SystemErrorPagelet(z3c.pagelet.browser.BrowserPagelet):
     """SystemError pagelet."""
 
+    zope.interface.implements(zope.browser.interfaces.ISystemErrorView)
 
-class UnauthorizedPagelet(browser.BrowserPagelet, Unauthorized):
+    def isSystemError(self):
+        return True
+
+
+class UnauthorizedPagelet(z3c.pagelet.browser.BrowserPagelet):
     """Unauthorized pagelet."""
 
     def render(self):
@@ -45,23 +48,24 @@
         self.request.response.setHeader('Pragma', 'no-cache')
 
         principal = self.request.principal
-        auth = zope.component.getUtility(IAuthentication)
+        auth = zope.component.getUtility(
+            zope.authentication.interfaces.IAuthentication)
         auth.unauthorized(principal.id, self.request)
         if self.request.response.getStatus() not in (302, 303):
-            template = zope.component.getMultiAdapter((self, self.request),
-                IContentTemplate)
+            template = zope.component.getMultiAdapter(
+                (self, self.request), z3c.template.interfaces.IContentTemplate)
             return template(self)
 
 
-class UserErrorPagelet(browser.BrowserPagelet, UserErrorView):
+class UserErrorPagelet(z3c.pagelet.browser.BrowserPagelet):
     """UserError pagelet."""
 
 
-class NotFoundPagelet(browser.BrowserPagelet, NotFound):
+class NotFoundPagelet(z3c.pagelet.browser.BrowserPagelet):
     """NotFound pagelet."""
 
     def render(self):
         self.request.response.setStatus(404)
-        template = zope.component.getMultiAdapter((self, self.request),
-            IContentTemplate)
+        template = zope.component.getMultiAdapter(
+            (self, self.request), z3c.template.interfaces.IContentTemplate)
         return template(self)

Modified: z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/tests/__init__.py
===================================================================
--- z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/tests/__init__.py	2009-05-25 19:15:22 UTC (rev 100370)
+++ z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/tests/__init__.py	2009-05-25 19:16:17 UTC (rev 100371)
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2007 Zope Foundation and Contributors.
+# Copyright (c) 2007-2009 Zope Foundation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,



More information about the Checkins mailing list