def needs_link(function):
    """
    Decorator to get the link object
    """
    @wraps(function)
    def wrapper(request, link_hash=None, *args, **kwargs):
        try:
            link = Link.objects.get(link_hash=link_hash)
        except __HOLE__:
            return HttpResponseRedirect('/')
        return function(request, link=link, *args, **kwargs)
    return wrapper
dataset/ETHPy150Open allink/pennyblack/pennyblack/views.py/needs_link