I have a theme fragment with schema.URI that has been used for external URLs.
Now I have a request about also make it possible to use internal links.
'Selecting the links' seems quite straightforward, but when I want to display them:
How can I do that in restricted python ?
( I assume https://github.com/plone/plone.app.contenttypes/blob/master/plone/app/contenttypes/browser/link_redirect_view.py is the place to look first )
Update:
looking closer, I see that a TAL/Chameleon (?) path is stored
so 'url' in my case is (a string):
${portal_url}/resolveuid/123456etc
So something like this would work, but it does not look like a 'correct way to me':
def get_url(self):
url = self.data['url']
if url.startswith('${portal_url}'):
spl_url = (url.split('/'))[1:]
url = '/'.join(spl_url)
context_state = self.context.restrictedTraverse(
'@@plone_context_state'
)
url = '/'.join([
context_state.canonical_object_url(), url
])
return url