def url_ref(value): if not value: return "" pRef = parse_ref(value, pad=False) if "error" in pRef: return value link = '<a href="/' + url(value) + '">' + value + '</a>' return mark_safe(link)
def url_ref(value): if value in url_ref_cache: return url_ref_cache[value] if not value: return "" pRef = parse_ref(value, pad=False) if "error" in pRef: return value link = '<a href="/' + url(value) + '">' + value + '</a>' url_ref_cache[value] = mark_safe(link) return url_ref_cache[value]