--- a/src/pyams_utils/traversing.py Mon Feb 18 17:12:39 2019 +0100
+++ b/src/pyams_utils/traversing.py Fri Feb 22 12:30:37 2019 +0100
@@ -115,17 +115,23 @@
traverser = registry.queryMultiAdapter((ob, request), ITraversable, '+')
if traverser is None:
raise NotFound()
- ob = traverser.traverse(vpath_tuple[vroot_idx + i + 2], vpath_tuple[vroot_idx + i + 3:])
- i += 1
- return {
- 'context': ob,
- 'view_name': ''.join(vpath_tuple[vroot_idx + i + 2:]),
- 'subpath': vpath_tuple[i + 2:],
- 'traversed': vpath_tuple[:vroot_idx + i + 2],
- 'virtual_root': vroot,
- 'virtual_root_path': vroot_tuple,
- 'root': root
- }
+ try:
+ ob = traverser.traverse(vpath_tuple[vroot_idx + i + 2], vpath_tuple[vroot_idx + i + 3:])
+ except IndexError:
+ # the "+" namespace traverser is waiting for additional elements from input URL
+ # so a "+" URL not followed by something else is just an error!
+ raise NotFound()
+ else:
+ i += 1
+ return {
+ 'context': ob,
+ 'view_name': ''.join(vpath_tuple[vroot_idx + i + 2:]),
+ 'subpath': vpath_tuple[i + 2:],
+ 'traversed': vpath_tuple[:vroot_idx + i + 2],
+ 'virtual_root': vroot,
+ 'virtual_root_path': vroot_tuple,
+ 'root': root
+ }
elif segment[:2] == ns_selector:
# check for namespace prefixed by '++'