summaryrefslogtreecommitdiff
path: root/tests/pkgs/hybridapp/__init__.py
diff options
context:
space:
mode:
authorMichael Merickel <github@m.merickel.org>2018-10-15 09:03:53 -0500
committerGitHub <noreply@github.com>2018-10-15 09:03:53 -0500
commit81576ee51564c49d5ff3c1c07f214f22a8438231 (patch)
tree5b3fe0b39a0fc33d545733d821738845909f638c /tests/pkgs/hybridapp/__init__.py
parent433efe06191a7007ca8c5bf8fafee5c7c1439ebb (diff)
parent17e3abf320f6d9cd90f7e5a0352280c2fef584af (diff)
downloadpyramid-81576ee51564c49d5ff3c1c07f214f22a8438231.tar.gz
pyramid-81576ee51564c49d5ff3c1c07f214f22a8438231.tar.bz2
pyramid-81576ee51564c49d5ff3c1c07f214f22a8438231.zip
Merge pull request #3387 from mmerickel/src-folder-refactor
refactor pyramid tests into a tests folder and package into a src folder
Diffstat (limited to 'tests/pkgs/hybridapp/__init__.py')
-rw-r--r--tests/pkgs/hybridapp/__init__.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/pkgs/hybridapp/__init__.py b/tests/pkgs/hybridapp/__init__.py
new file mode 100644
index 000000000..1cc2dde83
--- /dev/null
+++ b/tests/pkgs/hybridapp/__init__.py
@@ -0,0 +1,39 @@
+def includeme(config):
+ # <!-- we want this view to "win" -->
+ config.add_route('route', 'abc')
+ config.add_view('.views.route_view', route_name='route')
+ # <!-- .. even though this one has a more specific context -->
+ config.add_view('.views.global_view',
+ context='pyramid.traversal.DefaultRootFactory')
+ config.add_view('.views.global2_view',
+ context='pyramid.traversal.DefaultRootFactory',
+ name='global2')
+ config.add_route('route2', 'def')
+ # <!-- we want this view to win for route2 even though global view with
+ # context is more specific -->
+ config.add_view('.views.route2_view', route_name='route2')
+
+ # <!-- the global view should be found for this route -->
+ config.add_route('route3', 'ghi', use_global_views=True)
+ # <!-- the global view should not be found for this route -->
+ config.add_route('route4', 'jkl')
+ # <!-- the global view should not be found for this route (/global2) -->
+ config.add_route('route5', 'mno/*traverse')
+ # <!-- the global view should be found for this route (/global2) -->
+ config.add_route('route6', 'pqr/*traverse', use_global_views=True)
+ config.add_route('route7', 'error')
+ config.add_view('.views.erroneous_view', route_name='route7')
+ config.add_route('route8', 'error2')
+ config.add_view('.views.erroneous_view', route_name='route8')
+ # <!-- we want this view to "win" for route7 as exception view -->
+ config.add_view('.views.exception_view', context=RuntimeError)
+ # <!-- we want this view to "win" for route8 as exception view-->
+ config.add_view('.views.exception2_view', context=RuntimeError,
+ route_name='route8')
+ config.add_route('route9', 'error_sub')
+ config.add_view('.views.erroneous_sub_view', route_name='route9')
+ # <!-- we want this view to "win" for route9 as exception view... -->
+ config.add_view('.views.exception2_view', context='.views.SuperException',
+ route_name='route9')
+ # <!-- ...even if we have more context-specialized view for exception -->
+ config.add_view('.views.exception_view', context='.views.SubException')