(f)
return _wrapped
A decorator for views which act on a project. The function
    should take two kwargs, `u` (the username) and `p` (the project name),
    which will be resolved and replaced, or a 404 will be raised if either
    could not be found.
A decorator for views which act on a project. The function
    should take two kwargs, `u` (the username) and `p` (the project name),
    which will be resolved and replaced, or a 404 will be raised if either
    could not be found.
A decorator for views which act on a project . The function should take two kwargs u ( the username ) and p ( the project name ) which will be resolved and replaced or a 404 will be raised if either could not be found .
def project_action(f):
    """
    A decorator for views which act on a project. The function
    should take two kwargs, `u` (the username) and `p` (the project name),
    which will be resolved and replaced, or a 404 will be raised if either
    could not be found.
    """
    @wraps(f)
    def _wrapped(*args, **kwargs):
        u = User.by_username(kwargs.pop('u'))
        if not u:
            # No such user exists.
            return abort(404)

        p = Project.by_name_and_owner(kwargs.pop('p'), u)
        if not p:
            # Project doesn't exist (404 Not Found)
            return abort(404)

        kwargs['p'] = p
        kwargs['u'] = u

        return f(*args, **kwargs)
    return _wrapped
def project_action ( f ) : @ wraps ( f ) def _wrapped ( * args , * * kwargs ) : u = User . by_username ( kwargs . pop ( 'u' ) ) if not u : # No such user exists. return abort ( 404 ) p = Project . by_name_and_owner ( kwargs . pop ( 'p' ) , u ) if not p : # Project doesn't exist (404 Not Found) return abort ( 404 ) kwargs [ 'p' ] = p kwargs [ 'u' ] = u return f ( * args , * * kwargs ) return _wrapped