[Checkins] SVN: zope.errorview/trunk/src/zope/errorview/ pep8
Jan-Wijbrand Kolman
janwijbrand at gmail.com
Wed Jan 19 09:32:21 EST 2011
Log message for revision 119707:
pep8
Changed:
U zope.errorview/trunk/src/zope/errorview/browser.py
U zope.errorview/trunk/src/zope/errorview/http.py
U zope.errorview/trunk/src/zope/errorview/tests/test_browser.py
U zope.errorview/trunk/src/zope/errorview/tests/test_http.py
-=-
Modified: zope.errorview/trunk/src/zope/errorview/browser.py
===================================================================
--- zope.errorview/trunk/src/zope/errorview/browser.py 2011-01-19 14:21:55 UTC (rev 119706)
+++ zope.errorview/trunk/src/zope/errorview/browser.py 2011-01-19 14:32:20 UTC (rev 119707)
@@ -20,11 +20,13 @@
# XXX i18n-ing?
+
class ExceptionView(ExceptionView, BrowserPage):
def render(self):
return u'A system error occurred.'
+
class NotFoundView(ExceptionViewBase, BrowserPage):
def update(self):
@@ -33,6 +35,7 @@
def render(self):
return u'The requested resource can not be found.'
+
class UnauthorizedView(UnauthorizedView, BrowserPage):
def update(self):
Modified: zope.errorview/trunk/src/zope/errorview/http.py
===================================================================
--- zope.errorview/trunk/src/zope/errorview/http.py 2011-01-19 14:21:55 UTC (rev 119706)
+++ zope.errorview/trunk/src/zope/errorview/http.py 2011-01-19 14:32:20 UTC (rev 119707)
@@ -16,6 +16,7 @@
from zope.interface import implements
from zope.publisher.interfaces.http import IHTTPException
+
class SystemErrorViewMixin(object):
implements(ISystemErrorView)
@@ -23,6 +24,7 @@
def isSystemError(self):
return True
+
class ExceptionViewBase(object):
implements(IHTTPException)
@@ -44,24 +46,28 @@
def __str__(self):
return self()
+
class ExceptionView(ExceptionViewBase, SystemErrorViewMixin):
pass
+
class TraversalExceptionView(ExceptionViewBase):
def update(self):
- if self.request.method =='MKCOL' and self.request.getTraversalStack():
+ if self.request.method == 'MKCOL' and self.request.getTraversalStack():
# MKCOL with non-existing parent.
self.request.response.setStatus(409)
else:
self.request.response.setStatus(404)
+
class UnauthorizedView(ExceptionViewBase):
def update(self):
self.request.unauthorized('basic realm="Zope"')
self.request.response.setStatus(401)
+
class MethodNotAllowedView(ExceptionViewBase):
# XXX define an interface for MethodNotAllowedView components.
Modified: zope.errorview/trunk/src/zope/errorview/tests/test_browser.py
===================================================================
--- zope.errorview/trunk/src/zope/errorview/tests/test_browser.py 2011-01-19 14:21:55 UTC (rev 119706)
+++ zope.errorview/trunk/src/zope/errorview/tests/test_browser.py 2011-01-19 14:32:20 UTC (rev 119707)
@@ -27,11 +27,13 @@
browser_layer = ZCMLFileLayer(zope.errorview.tests)
+
class MockPrincipal(object):
id = 'mock principal'
+
class MockAuthenticationUtility(object):
- implements(IAuthentication) # this is a lie.
+ implements(IAuthentication) # this is a lie.
status = None
@@ -39,6 +41,7 @@
if self.status is not None:
request.response.setStatus(self.status)
+
class TestErrorViews(TestCase):
layer = browser_layer
Modified: zope.errorview/trunk/src/zope/errorview/tests/test_http.py
===================================================================
--- zope.errorview/trunk/src/zope/errorview/tests/test_http.py 2011-01-19 14:21:55 UTC (rev 119706)
+++ zope.errorview/trunk/src/zope/errorview/tests/test_http.py 2011-01-19 14:32:20 UTC (rev 119707)
@@ -26,6 +26,7 @@
from zope.security.interfaces import Unauthorized
import zope.errorview
+
class TestErrorViews(TestCase):
def setUp(self):
@@ -80,8 +81,10 @@
self.assertEquals(
self.request.response.getHeader('Allow'), 'GET, POST, PUT, DELETE')
+
http_layer = ZCMLFileLayer(zope.errorview, zcml_file='http.zcml')
+
class TestErrorViewsFunctional(TestCase):
layer = http_layer
More information about the checkins
mailing list