pgcontents/api_utils.py
def outside_root_to_404(fn):
    """
    Decorator for converting PathOutsideRoot errors to 404s.
    """
    @wraps(fn)
    def wrapped(*args, **kwargs):
        try:
            return fn(*args, **kwargs)
        except PathOutsideRoot as e:
            raise HTTPError(404, "Path outside root: [%s]" % e.args[0])
    return wrapped
def outside_root_to_404(fn):
    """
    Decorator for converting PathOutsideRoot errors to 404s.
    """
    @wraps(fn)
    def wrapped(*args, **kwargs):
        try:
            return fn(*args, **kwargs)
        except PathOutsideRoot as e:
            raise HTTPError(404, "Path outside root: [%s]" % e.args[0])
    return wrapped
Decorator for converting PathOutsideRoot errors to 404s.