merge_machine/api.py
def _protect_project(func):
    """Check that the password passed through POST is valid.    
    """
    if not REQUIRE_PASSWORD:
        return func
    
    @functools.wraps(func)
    def wrapper(*argv, **kwargs):
        
        # Get user token
        auth = request.authorization
        if auth is None:
            user_pwd = None
        else:
            auth.get('password')
        
        # Get real token
        project_id = locals()['kwargs']['project_id']
        real_pwd = _real_pwd(project_id)
        
        if user_pwd is None:
            return jsonify(error=True, message='No credentials were provided.'), 401

        if user_pwd != real_pwd:
            return jsonify(error=True, message='The password provided is incorrect.'), 403
    
        return func(*argv, **kwargs)
        
    return wrapper
Check that the password passed through POST is valid.    
    
Check that the password passed through POST is valid.
Check that the password passed through POST is valid .
def _protect_project(func):
    if not REQUIRE_PASSWORD:
        return func
    @functools.wraps(func)
    def wrapper(*argv, **kwargs):
        auth = request.authorization
        if auth is None:
            user_pwd = None
        else:
            auth.get('password')
        project_id = locals()['kwargs']['project_id']
        real_pwd = _real_pwd(project_id)
        if user_pwd is None:
            return jsonify(error=True, message='No credentials were provided.'), 401
        if user_pwd != real_pwd:
            return jsonify(error=True, message='The password provided is incorrect.'), 403
        return func(*argv, **kwargs)
    return wrapper
def _protect_project ( func ) : if not REQUIRE_PASSWORD : return func @ functools . wraps ( func ) def wrapper ( * argv , ** kwargs ) : auth = request . authorization if auth is None : user_pwd = None else : auth . get ( 'password' ) project_id = locals ( ) [ 'kwargs' ] [ 'project_id' ] real_pwd = _real_pwd ( project_id ) if user_pwd is None : return jsonify ( error = True , message = 'No credentials were provided.' ) , 401 if user_pwd != real_pwd : return jsonify ( error = True , message = 'The password provided is incorrect.' ) , 403 return func ( * argv , ** kwargs ) return wrapper
Check that the password passed through POST is valid.
Check that the password passed through POST is valid .
"""Check that the password passed through POST is valid.    
    """ # Get user token # Get real token
func