summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-05-31 16:52:41 +0000
committerChris McDonough <chrism@agendaless.com>2009-05-31 16:52:41 +0000
commit1db5469c9c189a1f5480e7f61e308a0179a2bd42 (patch)
tree4d35736b63519cf62ad36be4ef393098a4a85c8e
parentab8e062ee0c610063580373001b07756e6bd0fd4 (diff)
downloadpyramid-1db5469c9c189a1f5480e7f61e308a0179a2bd42.tar.gz
pyramid-1db5469c9c189a1f5480e7f61e308a0179a2bd42.tar.bz2
pyramid-1db5469c9c189a1f5480e7f61e308a0179a2bd42.zip
- Remove ``repoze.bfg.wsgi.HTTPException``,
``repoze.bfg.wsgi.NotFound``, and ``repoze.bfg.wsgi.Unauthorized``. These classes were disused with the introduction of the ``IUnauthorizedView`` and ``INotFoundView`` machinery.
-rw-r--r--CHANGES.txt5
-rw-r--r--repoze/bfg/tests/test_wsgi.py77
-rw-r--r--repoze/bfg/threadlocal.py1
-rw-r--r--repoze/bfg/wsgi.py24
4 files changed, 5 insertions, 102 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 071b7f2df..988d2f433 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -7,6 +7,11 @@ Removals
- Remove ``repoze.bfg.threadlocal.setManager``. It was only used in
unit tests.
+- Remove ``repoze.bfg.wsgi.HTTPException``,
+ ``repoze.bfg.wsgi.NotFound``, and ``repoze.bfg.wsgi.Unauthorized``.
+ These classes were disused with the introduction of the
+ ``IUnauthorizedView`` and ``INotFoundView`` machinery.
+
Documentation
-------------
diff --git a/repoze/bfg/tests/test_wsgi.py b/repoze/bfg/tests/test_wsgi.py
index 893364635..9d8a85630 100644
--- a/repoze/bfg/tests/test_wsgi.py
+++ b/repoze/bfg/tests/test_wsgi.py
@@ -109,76 +109,6 @@ class WSGIApp2Tests(unittest.TestCase):
self.assertEqual(request.environ['PATH_INFO'], '/')
self.assertEqual(request.environ['SCRIPT_NAME'], '')
-class TestNotFound(unittest.TestCase):
- def _getTargetClass(self):
- from repoze.bfg.wsgi import NotFound
- return NotFound
-
- def _makeOne(self):
- return self._getTargetClass()()
-
- def test_no_message(self):
- environ = {}
- L = []
- def start_response(status, headers):
- L.append((status, headers))
- app = self._makeOne()
- result = app(environ, start_response)
- self.assertEqual(len(result), 1)
- self.failUnless('404 Not Found' in result[0])
- self.assertEqual(L[0][0], '404 Not Found')
- self.assertEqual(L[0][1], [('Content-Length', str(len(result[0]))),
- ('Content-Type', 'text/html')])
-
- def test_with_message(self):
- environ = {'repoze.bfg.message':'<hi!>'}
- L = []
- def start_response(status, headers):
- L.append((status, headers))
- app = self._makeOne()
- result = app(environ, start_response)
- self.assertEqual(len(result), 1)
- self.failUnless('404 Not Found' in result[0])
- self.failUnless('&lt;hi!&gt;' in result[0])
- self.assertEqual(L[0][0], '404 Not Found')
- self.assertEqual(L[0][1], [('Content-Length', str(len(result[0]))),
- ('Content-Type', 'text/html')])
-
-class TestUnauthorized(unittest.TestCase):
- def _getTargetClass(self):
- from repoze.bfg.wsgi import Unauthorized
- return Unauthorized
-
- def _makeOne(self):
- return self._getTargetClass()()
-
- def test_no_message(self):
- environ = {}
- L = []
- def start_response(status, headers):
- L.append((status, headers))
- app = self._makeOne()
- result = app(environ, start_response)
- self.assertEqual(len(result), 1)
- self.failUnless('401 Unauthorized' in result[0])
- self.assertEqual(L[0][0], '401 Unauthorized')
- self.assertEqual(L[0][1], [('Content-Length', str(len(result[0]))),
- ('Content-Type', 'text/html')])
-
- def test_with_message(self):
- environ = {'repoze.bfg.message':'<hi!>'}
- L = []
- def start_response(status, headers):
- L.append((status, headers))
- app = self._makeOne()
- result = app(environ, start_response)
- self.assertEqual(len(result), 1)
- self.failUnless('401 Unauthorized' in result[0])
- self.failUnless('&lt;hi!&gt;' in result[0])
- self.assertEqual(L[0][0], '401 Unauthorized')
- self.assertEqual(L[0][1], [('Content-Length', str(len(result[0]))),
- ('Content-Type', 'text/html')])
-
def dummyapp(environ, start_response):
""" """
@@ -188,10 +118,3 @@ class DummyContext:
class DummyRequest:
def get_response(self, application):
return application
-
-
-
-
-
-
-
diff --git a/repoze/bfg/threadlocal.py b/repoze/bfg/threadlocal.py
index b35be187b..613ea4b65 100644
--- a/repoze/bfg/threadlocal.py
+++ b/repoze/bfg/threadlocal.py
@@ -31,4 +31,3 @@ def defaults():
return defaults
manager = ThreadLocalManager(defaults)
-
diff --git a/repoze/bfg/wsgi.py b/repoze/bfg/wsgi.py
index 027345673..a04be9e97 100644
--- a/repoze/bfg/wsgi.py
+++ b/repoze/bfg/wsgi.py
@@ -1,5 +1,3 @@
-from cgi import escape
-
try:
from functools import wraps
except ImportError: #pragma NO COVERAGE
@@ -102,25 +100,3 @@ def wsgiapp2(wrapped):
return request.get_response(wrapped)
return wraps(wrapped)(decorator) # grokkability
-class HTTPException(object):
- def __call__(self, environ, start_response, exc_info=False):
- try:
- msg = escape(environ['repoze.bfg.message'])
- except KeyError:
- msg = ''
- html = """<body>
- <html><title>%s</title><body><h1>%s</h1>
- <code>%s</code>
- """ % (self.status, self.status, msg)
- headers = [('Content-Length', str(len(html))),
- ('Content-Type', 'text/html')]
- start_response(self.status, headers)
- return [html]
-
-class NotFound(HTTPException):
- """ The default NotFound WSGI application """
- status = '404 Not Found'
-
-class Unauthorized(HTTPException):
- """ The default Unauthorized WSGI application """
- status = '401 Unauthorized'