def link(page, variant=model.Text.HEAD, link=True, icon=True, icon_size=16): import text_helper as text buf = cgi.escape(page.title) text_ = page.variant_head(variant) if text_ is None: return _("(Unknown)") if variant != text_.HEAD: buf = u"%s <code>(%s)</code>" % (buf, variant) if icon: buf = (u"<img class='dgb_icon' src='%s' /> %s" % (text.icon_url(text_, page, size=icon_size), buf)) if link and not page.is_deleted(): buf = (u"<a class='page_link exists' href='%s'>%s</a>" % (text.url(text_), buf)) return buf
def icon_url(page, size=16): import text_helper as text return text.icon_url(page.head, page, size=size)