Commit 7e7c3397 authored by 's avatar

- removed ancient backwards compatibility code

parent f983b270
...@@ -11,6 +11,10 @@ Trunk (unreleased) ...@@ -11,6 +11,10 @@ Trunk (unreleased)
Restructuring 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 - Testing: Functional.publish now uses the real publish_module function
instead of that from ZPublisher.Test. The 'extra' argument of the publish instead of that from ZPublisher.Test. The 'extra' argument of the publish
method is no longer supported. method is no longer supported.
......
...@@ -263,25 +263,20 @@ class ZPublisherExceptionHook: ...@@ -263,25 +263,20 @@ class ZPublisherExceptionHook:
if REQUEST.get('AUTHENTICATED_USER', None) is None: if REQUEST.get('AUTHENTICATED_USER', None) is None:
REQUEST['AUTHENTICATED_USER'] = AccessControl.User.nobody REQUEST['AUTHENTICATED_USER'] = AccessControl.User.nobody
try: result = f(client, REQUEST, t, v, traceback,
result = f(client, REQUEST, t, v, error_log_url=error_log_url)
traceback, if result is not None:
error_log_url=error_log_url) t, v, traceback = result
if result is not None: if issubclass(t, Unauthorized):
t, v, traceback = result # Re-raise Unauthorized to make sure it is handled
if issubclass(t, Unauthorized): # correctly. We can't do that with all exceptions
# Re-raise Unauthorized to make sure it is handled # because some don't work with the rendered v as
# correctly. We can't do that with all exceptions # argument.
# because some don't work with the rendered v as raise t, v, traceback
# argument. response = REQUEST.RESPONSE
raise t, v, traceback response.setStatus(t)
response = REQUEST.RESPONSE response.setBody(v)
response.setStatus(t) return response
response.setBody(v)
return response
except TypeError:
# BBB: Pre Zope 2.6 call signature
f(client, REQUEST, t, v, traceback)
finally: finally:
traceback = None traceback = None
......
...@@ -225,12 +225,6 @@ class Client(Acquisition.Explicit): ...@@ -225,12 +225,6 @@ class Client(Acquisition.Explicit):
def dummyMethod(self): def dummyMethod(self):
return 'Aye' 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): class StandardClient(Client):
def raise_standardErrorMessage(self, c, r, t, v, tb, error_log_url): def raise_standardErrorMessage(self, c, r, t, v, tb, error_log_url):
...@@ -245,17 +239,6 @@ class BrokenClient(Client): ...@@ -245,17 +239,6 @@ class BrokenClient(Client):
class ExceptionMessageRenderTest(ExceptionHookTestCase): 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): def testRenderUnauthorizedStandardClient(self):
from AccessControl import Unauthorized from AccessControl import Unauthorized
def f(): 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