I have a class like this, that generates hyperlinks:
class getLink(obj):
def __init__(self, text, url):
self.text = self.Argument(text)
self.url = self.Argument(url)
def render(self, context):
return "%s %s" % (html.link(self.text(context), self.url(context)))
def link(text, url):
return mark_safe('<a href="%s">%s</a>' % (url, title))
Then to get a Link I do thus:
getLink(text=_('Test'),fn.getUrl())
HTML result:
<a href="/python/tests/">Test</a>
I want to wrap the link inside a <div> and another inside a <li> tag. I tried to add the tags directly in getLink() but doesn't work
getLink("<div>" + text=_('Test'),fn.getUrl() + "</div>"). I'm newbie in Python so sorry if I'm wrong.
Thanks for you help!
getLink("<div>" + text=_('Test'),fn.getUrl() + "</div>")is invalid syntax in Python.