--- a/src/pyams_utils/traversing.py Mon May 28 14:07:10 2018 +0200
+++ b/src/pyams_utils/traversing.py Wed May 30 14:55:51 2018 +0200
@@ -111,6 +111,7 @@
request.registry.notify(BeforeTraverseEvent(ob, request))
if segment[:2] == view_selector:
+ # check for view name prefixed by '@@'
return {'context': ob,
'view_name': segment[2:],
'subpath': vpath_tuple[i + 1:],
@@ -119,7 +120,12 @@
'virtual_root_path': vroot_tuple,
'root': root}
- if segment[:2] == ns_selector:
+ elif segment[:2] == ns_selector:
+ # check for namespace prefixed by '++'
+ # when a namespace is detected, named "ITraversable" multi-adapters are searched for
+ # context and request, for context and for request, sequentially; a NotFound exception is
+ # raised if traverser can't be found, otherwise it's "traverse" method is called to get new
+ # context
ns, name = segment[2:].split(ns_selector, 1)
registry = get_current_registry()
traverser = registry.queryMultiAdapter((ob, request), ITraversable, ns)
@@ -159,6 +165,9 @@
ob = next
i += 1
+ if ob is not root:
+ request.registry.notify(BeforeTraverseEvent(ob, request))
+
return {'context': ob,
'view_name': empty,
'subpath': subpath,