コード例 #1
0
ファイル: main.py プロジェクト: computmaxer/vinz
def page_not_found(e):
    """
    If this request was for the API, return JSON 404 error.  Otherwise render the angular app.
    """
    if request.path.startswith('/api/'):
        response = {'error': "Page Not Found", 'error_code': HTTP_STATUS.NOT_FOUND}
        return output_json(response, HTTP_STATUS.NOT_FOUND)
    return views.index()
コード例 #2
0
ファイル: __init__.py プロジェクト: ericfeldmann/vinz
def user_unauthorized_callback():
    """
    If this is a REST API request, return JSON error message (401).
    Otherwise redirect to the login page.
    """
    if request.path.startswith('/api/'):
        response = {'error': "Unauthorized", 'error_code': HTTP_STATUS.UNAUTHORIZED}
        return output_json(response, HTTP_STATUS.UNAUTHORIZED)
    else:
        return redirect('login')
コード例 #3
0
def page_not_found(e):
    """
    If this request was for the API, return JSON 404 error.  Otherwise render the angular app.
    """
    if request.path.startswith('/api/'):
        response = {
            'error': "Page Not Found",
            'error_code': HTTP_STATUS.NOT_FOUND
        }
        return output_json(response, HTTP_STATUS.NOT_FOUND)
    return views.index()
コード例 #4
0
ファイル: __init__.py プロジェクト: qinxiaoapp/vinz
def user_unauthorized_callback():
    """
    If this is a REST API request, return JSON error message (401).
    Otherwise redirect to the login page.
    """
    if request.path.startswith('/api/'):
        response = {
            'error': "Unauthorized",
            'error_code': HTTP_STATUS.UNAUTHORIZED
        }
        return output_json(response, HTTP_STATUS.UNAUTHORIZED)
    else:
        return redirect('login')