Internal links in theme fragments (restricted python)

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 is the place to look first )

looking closer, I see that a TAL/Chameleon (?) path is stored

so 'url' in my case is (a string):


So something like this would work, but it does not look like a 'correct way to me':

    def get_url(self):
        url =['url']
        if url.startswith('${portal_url}'):
            spl_url =  (url.split('/'))[1:]
            url = '/'.join(spl_url)
            context_state = self.context.restrictedTraverse(
            url = '/'.join([
                context_state.canonical_object_url(), url
        return url