diff options
| author | Michael Merickel <michael@merickel.org> | 2018-10-15 01:55:54 -0500 |
|---|---|---|
| committer | Michael Merickel <michael@merickel.org> | 2018-10-15 09:24:07 -0500 |
| commit | 0c29cf2df41600d3906d521c72991c7686018b71 (patch) | |
| tree | ff907f90ec9467e12874c9b2c961549d0e7caf74 /tests/pkgs/exceptionviewapp | |
| parent | 851c368e3c158e264358de10446f5b5de240e534 (diff) | |
| download | pyramid-0c29cf2df41600d3906d521c72991c7686018b71.tar.gz pyramid-0c29cf2df41600d3906d521c72991c7686018b71.tar.bz2 pyramid-0c29cf2df41600d3906d521c72991c7686018b71.zip | |
format source using black
Diffstat (limited to 'tests/pkgs/exceptionviewapp')
| -rw-r--r-- | tests/pkgs/exceptionviewapp/__init__.py | 56 | ||||
| -rw-r--r-- | tests/pkgs/exceptionviewapp/models.py | 6 | ||||
| -rw-r--r-- | tests/pkgs/exceptionviewapp/views.py | 9 |
3 files changed, 49 insertions, 22 deletions
diff --git a/tests/pkgs/exceptionviewapp/__init__.py b/tests/pkgs/exceptionviewapp/__init__.py index ffc1b47c6..19804d242 100644 --- a/tests/pkgs/exceptionviewapp/__init__.py +++ b/tests/pkgs/exceptionviewapp/__init__.py @@ -1,31 +1,47 @@ from pyramid.httpexceptions import HTTPException + def includeme(config): config.add_route('route_raise_exception', 'route_raise_exception') config.add_route('route_raise_httpexception', 'route_raise_httpexception') - config.add_route('route_raise_exception2', 'route_raise_exception2', - factory='.models.route_factory') - config.add_route('route_raise_exception3', 'route_raise_exception3', - factory='.models.route_factory2') + config.add_route( + 'route_raise_exception2', + 'route_raise_exception2', + factory='.models.route_factory', + ) + config.add_route( + 'route_raise_exception3', + 'route_raise_exception3', + factory='.models.route_factory2', + ) config.add_route('route_raise_exception4', 'route_raise_exception4') config.add_view('.views.maybe') config.add_view('.views.no', context='.models.NotAnException') config.add_view('.views.yes', context=".models.AnException") config.add_view('.views.raise_exception', name='raise_exception') - config.add_view('.views.raise_exception', - route_name='route_raise_exception') - config.add_view('.views.raise_exception', - route_name='route_raise_exception2') - config.add_view('.views.raise_exception', - route_name='route_raise_exception3') - config.add_view('.views.whoa', context='.models.AnException', - route_name='route_raise_exception3') - config.add_view('.views.raise_exception', - route_name='route_raise_exception4') - config.add_view('.views.whoa', context='.models.AnException', - route_name='route_raise_exception4') - config.add_view('.views.raise_httpexception', - route_name='route_raise_httpexception') + config.add_view( + '.views.raise_exception', route_name='route_raise_exception' + ) + config.add_view( + '.views.raise_exception', route_name='route_raise_exception2' + ) + config.add_view( + '.views.raise_exception', route_name='route_raise_exception3' + ) + config.add_view( + '.views.whoa', + context='.models.AnException', + route_name='route_raise_exception3', + ) + config.add_view( + '.views.raise_exception', route_name='route_raise_exception4' + ) + config.add_view( + '.views.whoa', + context='.models.AnException', + route_name='route_raise_exception4', + ) + config.add_view( + '.views.raise_httpexception', route_name='route_raise_httpexception' + ) config.add_view('.views.catch_httpexception', context=HTTPException) - - diff --git a/tests/pkgs/exceptionviewapp/models.py b/tests/pkgs/exceptionviewapp/models.py index fe407badc..25f8e9156 100644 --- a/tests/pkgs/exceptionviewapp/models.py +++ b/tests/pkgs/exceptionviewapp/models.py @@ -1,18 +1,22 @@ - class NotAnException(object): pass + class AnException(Exception): pass + class RouteContext(object): pass + class RouteContext2(object): pass + def route_factory(*arg): return RouteContext() + def route_factory2(*arg): return RouteContext2() diff --git a/tests/pkgs/exceptionviewapp/views.py b/tests/pkgs/exceptionviewapp/views.py index 4953056bc..ca2c4fffb 100644 --- a/tests/pkgs/exceptionviewapp/views.py +++ b/tests/pkgs/exceptionviewapp/views.py @@ -2,23 +2,30 @@ from webob import Response from .models import AnException from pyramid.httpexceptions import HTTPBadRequest + def no(request): return Response('no') + def yes(request): return Response('yes') - + + def maybe(request): return Response('maybe') + def whoa(request): return Response('whoa') + def raise_exception(request): raise AnException() + def raise_httpexception(request): raise HTTPBadRequest + def catch_httpexception(request): return Response('caught') |
