Added test to avoid several notifications before traversing root object
authorThierry Florac <thierry.florac@onf.fr>
Thu, 15 Mar 2018 09:24:20 +0100
changeset 151 a24a40d4f0c7
parent 150 09f49ce8dfd8
child 152 98ded173ec22
Added test to avoid several notifications before traversing root object
src/pyams_utils/traversing.py
--- a/src/pyams_utils/traversing.py	Thu Mar 15 09:23:39 2018 +0100
+++ b/src/pyams_utils/traversing.py	Thu Mar 15 09:24:20 2018 +0100
@@ -107,7 +107,8 @@
             vpath_tuple = split_path_info(vpath)
 
             for segment in vpath_tuple:
-                request.registry.notify(BeforeTraverseEvent(ob, request))
+                if ob is not root:
+                    request.registry.notify(BeforeTraverseEvent(ob, request))
 
                 if segment[:2] == view_selector:
                     return {'context': ob,