# HG changeset patch # User Thierry Florac # Date 1516121326 -3600 # Node ID 0fcad7725bdc134197c36f6094203debd4e66178 # Parent e2aeba0dd99cd6cbb5bb94277fa81c5c1cc68e95 Handle absolute_url when 'context' argument is a string diff -r e2aeba0dd99c -r 0fcad7725bdc src/pyams_utils/url.py --- a/src/pyams_utils/url.py Sun Jan 14 15:01:29 2018 +0100 +++ b/src/pyams_utils/url.py Tue Jan 16 17:48:46 2018 +0100 @@ -38,6 +38,11 @@ add checks to remove some double slashes, and add control on view name when it begins with a '#' character which is used by MyAMS.js framework. """ + + # if we pass a string to absolute_url(), argument is returned as-is! + if isinstance(context, str): + return context + # 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(':/', '://')