Commit 7e7c3397 authored by 's avatar

- removed ancient backwards compatibility code

parent f983b270
......@@ -11,6 +11,10 @@ Trunk (unreleased)
Restructuring
+++++++++++++
- ZPublisherExceptionHook: Removed ancient backwards compatibility code.
Customized raise_standardErrorMessage methods have to implement the
signature introduced in Zope 2.6.
- Testing: Functional.publish now uses the real publish_module function
instead of that from ZPublisher.Test. The 'extra' argument of the publish
method is no longer supported.
......
......@@ -263,25 +263,20 @@ class ZPublisherExceptionHook:
if REQUEST.get('AUTHENTICATED_USER', None) is None:
REQUEST['AUTHENTICATED_USER'] = AccessControl.User.nobody
try:
result = f(client, REQUEST, t, v,
traceback,
error_log_url=error_log_url)
if result is not None:
t, v, traceback = result
if issubclass(t, Unauthorized):
# Re-raise Unauthorized to make sure it is handled
# correctly. We can't do that with all exceptions
# because some don't work with the rendered v as
# argument.
raise t, v, traceback
response = REQUEST.RESPONSE
response.setStatus(t)
response.setBody(v)
return response
except TypeError:
# BBB: Pre Zope 2.6 call signature
f(client, REQUEST, t, v, traceback)
result = f(client, REQUEST, t, v, traceback,
error_log_url=error_log_url)
if result is not None:
t, v, traceback = result
if issubclass(t, Unauthorized):
# Re-raise Unauthorized to make sure it is handled
# correctly. We can't do that with all exceptions
# because some don't work with the rendered v as
# argument.
raise t, v, traceback
response = REQUEST.RESPONSE
response.setStatus(t)
response.setBody(v)
return response
finally:
traceback = None
......
......@@ -225,12 +225,6 @@ class Client(Acquisition.Explicit):
def dummyMethod(self):
return 'Aye'
class OldClient(Client):
def raise_standardErrorMessage(self, c, r, t, v, tb):
from zExceptions.ExceptionFormatter import format_exception
self.messages.append(''.join(format_exception(t, v, tb, as_html=0)))
class StandardClient(Client):
def raise_standardErrorMessage(self, c, r, t, v, tb, error_log_url):
......@@ -245,17 +239,6 @@ class BrokenClient(Client):
class ExceptionMessageRenderTest(ExceptionHookTestCase):
def testRenderUnauthorizedOldClient(self):
from AccessControl import Unauthorized
def f():
raise Unauthorized, 1
request = self._makeRequest()
client = OldClient()
self.call(client, request, f)
self.failUnless(client.messages, client.messages)
tb = client.messages[0]
self.failUnless("Unauthorized: You are not allowed" in tb, tb)
def testRenderUnauthorizedStandardClient(self):
from AccessControl import Unauthorized
def f():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment