--- a/src/pyams_utils/url.py Wed May 20 12:40:19 2015 +0200
+++ b/src/pyams_utils/url.py Wed May 20 12:41:21 2015 +0200
@@ -27,7 +27,9 @@
def absolute_url(context, request, view_name=None):
"""Get resource absolute_url"""
- result = resource_url(context, request)
+ # if we have several parents without name in the lineage, the resource URL contains a double slash
+ # which generates "NotFound" exceptions; so we replace it with a single slash...
+ result = resource_url(context, request).replace('//', '/').replace(':/', '://')
if result.endswith('/'):
result = result[:-1]
if view_name:
@@ -42,7 +44,7 @@
class AbsoluteUrlTalesExtension(ContextRequestViewAdapter):
"""extension:absolute_url(context) TALES extension"""
- def render(self, context):
+ def render(self, context=None, view_name=None):
if context is None:
context = self.context
- return absolute_url(context, self.request)
+ return absolute_url(context, self.request, view_name)