summaryrefslogtreecommitdiff
path: root/repoze
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-10-23 21:00:09 +0000
committerChris McDonough <chrism@agendaless.com>2009-10-23 21:00:09 +0000
commit85b19518f409f7ce78d2cd4c5c18cd705ba8489e (patch)
treeb4f689c1ec91089a941c8d3dcbec69e157655314 /repoze
parent839ea015f9bc8c8096107e700a42bb872e9dc0c8 (diff)
downloadpyramid-85b19518f409f7ce78d2cd4c5c18cd705ba8489e.tar.gz
pyramid-85b19518f409f7ce78d2cd4c5c18cd705ba8489e.tar.bz2
pyramid-85b19518f409f7ce78d2cd4c5c18cd705ba8489e.zip
Remove 'Respond' exception (its addition would be purely speculative: we solved the reissue_time authentication policy issue a different way).
Diffstat (limited to 'repoze')
-rw-r--r--repoze/bfg/exceptions.py26
-rw-r--r--repoze/bfg/router.py3
-rw-r--r--repoze/bfg/tests/test_router.py25
3 files changed, 1 insertions, 53 deletions
diff --git a/repoze/bfg/exceptions.py b/repoze/bfg/exceptions.py
index bc05fa699..afd617a2c 100644
--- a/repoze/bfg/exceptions.py
+++ b/repoze/bfg/exceptions.py
@@ -22,29 +22,3 @@ class NotFound(Exception):
into the WSGI environment under the ``repoze.bfg.message`` key,
for availability to the Not Found view."""
-class Respond(Exception):
- """\
- Raise this exception during view execution to return a response
- immediately without proceeeding any further through the codepath.
- Use of this exception is effectively a 'goto': its target is the
- exception handler within the :mod:`repoze.bfg' router that catches
- the exception and returns a response immediately. Note that
- because this exception is caught by the router, it will not
- propagate to any WSGI middleware. Note that this exception is
- typically only used by the framework itself and by authentication
- plugins to the framework.
-
- The exception must be initialized which a single argument, which
- is a :term:`response` object.
-
- An example:
-
- .. code-block:: python
- :linenos:
-
- from webob.exc import HTTPFound
- from repoze.bfg.exceptions import Respond
- response = HTTPFound(location='http://example.com')
- raise Respond(response)
- """
-
diff --git a/repoze/bfg/router.py b/repoze/bfg/router.py
index 03f93857c..41b8ee553 100644
--- a/repoze/bfg/router.py
+++ b/repoze/bfg/router.py
@@ -19,7 +19,6 @@ from repoze.bfg.events import NewResponse
from repoze.bfg.events import WSGIApplicationCreatedEvent
from repoze.bfg.exceptions import Forbidden
from repoze.bfg.exceptions import NotFound
-from repoze.bfg.exceptions import Respond
from repoze.bfg.request import request_factory
from repoze.bfg.threadlocal import manager
from repoze.bfg.traversal import ModelGraphTraverser
@@ -115,8 +114,6 @@ class Router(object):
msg = why[0]
environ['repoze.bfg.message'] = msg
response = self.notfound_view(context, request)
- except Respond, why:
- response = why[0]
registry.has_listeners and registry.notify(NewResponse(response))
diff --git a/repoze/bfg/tests/test_router.py b/repoze/bfg/tests/test_router.py
index 9306640b4..50a763688 100644
--- a/repoze/bfg/tests/test_router.py
+++ b/repoze/bfg/tests/test_router.py
@@ -372,25 +372,6 @@ class TestRouter(unittest.TestCase):
self.assertEqual(start_response.status, '404 Not Found')
self.assertEqual(environ['repoze.bfg.message'], 'notfound')
- def test_call_view_raises_respond(self):
- from zope.interface import Interface
- from zope.interface import directlyProvides
- class IContext(Interface):
- pass
- from repoze.bfg.interfaces import IRequest
- context = DummyContext()
- directlyProvides(context, IContext)
- self._registerTraverserFactory(context, subpath=[''])
- response = DummyResponse('200 OK')
- raised = DummyResponse('201 Created')
- view = DummyView(response, raise_respond=raised)
- environ = self._makeEnviron()
- self._registerView(view, '', IContext, IRequest)
- router = self._makeOne()
- start_response = DummyStartResponse()
- response = router(environ, start_response)
- self.assertEqual(start_response.status, '201 Created')
-
def test_call_request_has_global_response_headers(self):
from zope.interface import Interface
from zope.interface import directlyProvides
@@ -506,11 +487,10 @@ class DummyContext:
class DummyView:
def __init__(self, response, raise_unauthorized=False,
- raise_notfound=False, raise_respond=False):
+ raise_notfound=False):
self.response = response
self.raise_unauthorized = raise_unauthorized
self.raise_notfound = raise_notfound
- self.raise_respond = raise_respond
def __call__(self, context, request):
if self.raise_unauthorized:
@@ -519,9 +499,6 @@ class DummyView:
if self.raise_notfound:
from repoze.bfg.exceptions import NotFound
raise NotFound('notfound')
- if self.raise_respond:
- from repoze.bfg.exceptions import Respond
- raise Respond(self.raise_respond)
return self.response
class DummyRootFactory: