merge default doc-dc
authorDamien Correia
Wed, 30 May 2018 15:07:56 +0200
branchdoc-dc
changeset 261 a11273a42e18
parent 260 1ed791a40890 (current diff)
parent 187 fe50c0414855 (diff)
child 262 4abd201debc6
merge default
--- a/src/pyams_utils/traversing.py	Tue May 29 11:13:16 2018 +0200
+++ b/src/pyams_utils/traversing.py	Wed May 30 15:07:56 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,