diff options
| -rw-r--r-- | CHANGES.txt | 3 | ||||
| -rw-r--r-- | docs/narr/configuration.rst | 1 | ||||
| -rw-r--r-- | pyramid/tests/test_wsgi.py | 6 | ||||
| -rw-r--r-- | pyramid/wsgi.py | 7 |
4 files changed, 16 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index b0495617b..c14939d81 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -11,6 +11,9 @@ Next release add_route_predicate for example can not take a string and turn it into the actual callable function. +- ``pyramid.wsgi.wsgiapp`` and ``pyramid.wsgi.wsgiapp2`` now raise + ``ValueError`` when accidentally passed ``None``. + 1.5 (2014-04-08) ================ diff --git a/docs/narr/configuration.rst b/docs/narr/configuration.rst index f7a69d613..52615533d 100644 --- a/docs/narr/configuration.rst +++ b/docs/narr/configuration.rst @@ -114,7 +114,6 @@ in a package and its subpackages. For example: return Response('Hello') if __name__ == '__main__': - from pyramid.config import Configurator config = Configurator() config.scan() app = config.make_wsgi_app() diff --git a/pyramid/tests/test_wsgi.py b/pyramid/tests/test_wsgi.py index 63499b43b..4ddbc9201 100644 --- a/pyramid/tests/test_wsgi.py +++ b/pyramid/tests/test_wsgi.py @@ -5,6 +5,9 @@ class WSGIAppTests(unittest.TestCase): from pyramid.wsgi import wsgiapp return wsgiapp(app) + def test_wsgiapp_none(self): + self.assertRaises(ValueError, self._callFUT, None) + def test_decorator(self): context = DummyContext() request = DummyRequest() @@ -25,6 +28,9 @@ class WSGIApp2Tests(unittest.TestCase): from pyramid.wsgi import wsgiapp2 return wsgiapp2(app) + def test_wsgiapp2_none(self): + self.assertRaises(ValueError, self._callFUT, None) + def test_decorator_with_subpath_and_view_name(self): context = DummyContext() request = DummyRequest() diff --git a/pyramid/wsgi.py b/pyramid/wsgi.py index d176e4ce5..1c1bded32 100644 --- a/pyramid/wsgi.py +++ b/pyramid/wsgi.py @@ -29,6 +29,10 @@ def wsgiapp(wrapped): view. """ + + if wrapped is None: + raise ValueError('wrapped can not be None') + def decorator(context, request): return request.get_response(wrapped) @@ -69,6 +73,9 @@ def wsgiapp2(wrapped): subpath is used as the ``SCRIPT_NAME``. The new environment is passed to the downstream WSGI application.""" + if wrapped is None: + raise ValueError('wrapped can not be None') + def decorator(context, request): return call_app_with_subpath_as_path_info(request, wrapped) |
