Source

garter / garter / urls.py

Full commit
from flask import url_for
from werkzeug.routing import BuildError

def permalink(function):
    def inner(*args, **kwargs):
        endpoint, values = function(*args, **kwargs)
        try:
            return url_for(endpoint, **values)
        except BuildError:
            return
    return inner