diff options
| author | Chris McDonough <chrism@agendaless.com> | 2010-04-14 02:49:19 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2010-04-14 02:49:19 +0000 |
| commit | ff1213e8f2aed987108ba57aed517c033491b1aa (patch) | |
| tree | f531544c3373ae7d5b51746987cb373326277a9c /repoze/bfg/tests/exceptionviewapp | |
| parent | 2b6bc8adfa294f7133680f64df411251afb67dfc (diff) | |
| download | pyramid-ff1213e8f2aed987108ba57aed517c033491b1aa.tar.gz pyramid-ff1213e8f2aed987108ba57aed517c033491b1aa.tar.bz2 pyramid-ff1213e8f2aed987108ba57aed517c033491b1aa.zip | |
Add "exception views" work contributed primarily by Andrey Popp by merging the "phash" branch.
Diffstat (limited to 'repoze/bfg/tests/exceptionviewapp')
| -rw-r--r-- | repoze/bfg/tests/exceptionviewapp/__init__.py | 1 | ||||
| -rw-r--r-- | repoze/bfg/tests/exceptionviewapp/configure.zcml | 44 | ||||
| -rw-r--r-- | repoze/bfg/tests/exceptionviewapp/models.py | 18 | ||||
| -rw-r--r-- | repoze/bfg/tests/exceptionviewapp/views.py | 17 |
4 files changed, 80 insertions, 0 deletions
diff --git a/repoze/bfg/tests/exceptionviewapp/__init__.py b/repoze/bfg/tests/exceptionviewapp/__init__.py new file mode 100644 index 000000000..ef5fe8b12 --- /dev/null +++ b/repoze/bfg/tests/exceptionviewapp/__init__.py @@ -0,0 +1 @@ +# a package diff --git a/repoze/bfg/tests/exceptionviewapp/configure.zcml b/repoze/bfg/tests/exceptionviewapp/configure.zcml new file mode 100644 index 000000000..680e065a6 --- /dev/null +++ b/repoze/bfg/tests/exceptionviewapp/configure.zcml @@ -0,0 +1,44 @@ +<configure xmlns="http://namespaces.repoze.org/bfg"> + + <include package="repoze.bfg.includes" /> + + <view view=".views.maybe"/> + + <view context=".models.NotAnException" + view=".views.no"/> + + <view context=".models.AnException" + view=".views.yes"/> + + <view name="raise_exception" + view=".views.raise_exception"/> + + <route name="route_raise_exception" + path="route_raise_exception" + view=".views.raise_exception"/> + + <route name="route_raise_exception2" + path="route_raise_exception2" + view=".views.raise_exception" + factory=".models.route_factory"/> + + <route name="route_raise_exception3" + path="route_raise_exception3" + view=".views.raise_exception" + factory=".models.route_factory2"/> + + <view context=".models.AnException" + route_name="route_raise_exception3" + view=".views.whoa"/> + + <route name="route_raise_exception4" + path="route_raise_exception4" + view=".views.raise_exception"/> + + <view context=".models.AnException" + route_name="route_raise_exception4" + view=".views.whoa"/> + +</configure> + + diff --git a/repoze/bfg/tests/exceptionviewapp/models.py b/repoze/bfg/tests/exceptionviewapp/models.py new file mode 100644 index 000000000..fe407badc --- /dev/null +++ b/repoze/bfg/tests/exceptionviewapp/models.py @@ -0,0 +1,18 @@ + +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/repoze/bfg/tests/exceptionviewapp/views.py b/repoze/bfg/tests/exceptionviewapp/views.py new file mode 100644 index 000000000..1432618cf --- /dev/null +++ b/repoze/bfg/tests/exceptionviewapp/views.py @@ -0,0 +1,17 @@ +from webob import Response +from models import AnException + +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() |
