Use relative URL in internal links
authorThierry Florac <thierry.florac@onf.fr>
Fri, 22 Jun 2018 12:52:10 +0200
changeset 726 9a3eda154460
parent 725 ff35457b30a6
child 727 c142e315427a
Use relative URL in internal links
src/pyams_content/component/links/__init__.py
--- a/src/pyams_content/component/links/__init__.py	Thu Jun 21 16:58:29 2018 +0200
+++ b/src/pyams_content/component/links/__init__.py	Fri Jun 22 12:52:10 2018 +0200
@@ -9,6 +9,7 @@
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
 #
+from pyams_skin.layer import IPyAMSUserLayer
 
 __docformat__ = 'restructuredtext'
 
@@ -35,7 +36,7 @@
 from pyams_utils.registry import query_utility
 from pyams_utils.request import check_request
 from pyams_utils.traversing import get_parent
-from pyams_utils.url import absolute_url
+from pyams_utils.url import absolute_url, relative_url
 from pyams_utils.vocabulary import vocabulary_config
 from pyams_utils.zodb import volatile_property
 from zope.interface import implementer
@@ -132,11 +133,11 @@
         return 'oid://{0}'.format(self.reference)
 
     def get_url(self, request=None, view_name=None):
-        target = self.get_target(state=VISIBLE_STATES)
+        target = self.get_target()
         if target is not None:
             if request is None:
                 request = check_request()
-            return absolute_url(target, request, view_name)
+            return relative_url(target, request, view_name=view_name)
         else:
             return ''