Beispiel #1
0
    return jsonify(body, status=exc.code,
        headers=exc.get_headers(request.environ))


@app.errorhandler(Invalid)
def handle_invalid(exc):
    body = {
        'status': 400,
        'name': 'Invalid Data',
        'description': unicode(exc),
        'errors': exc.unpack_errors()
    }
    return jsonify(body, status=400)


app.register_blueprint(upload)
app.register_blueprint(reconcile, url_prefix='/api/2')
app.register_blueprint(sessions, url_prefix='/api/2')
app.register_blueprint(datasets, url_prefix='/api/2')
app.register_blueprint(entities, url_prefix='/api/2')
app.register_blueprint(matching, url_prefix='/api/2')


def angular_templates():
    if app.config.get('ASSETS_DEBUG'):
        return
    partials_dir = os.path.join(app.static_folder, 'templates')
    for (root, dirs, files) in os.walk(partials_dir):
        for file_name in files:
            file_path = os.path.join(root, file_name)
            with open(file_path, 'rb') as fh:
Beispiel #2
0
    else:
        request.account = None


@app.errorhandler(Invalid)
def handle_invalid(exc):
    body = {
        'status': 400,
        'name': 'Invalid Data',
        'description': str(exc),
        'errors': exc.unpack_errors()
    }
    return jsonify(body, status=400)


app.register_blueprint(upload, url_prefix='/api/2')
app.register_blueprint(reconcile, url_prefix='/api/2')
app.register_blueprint(sessions, url_prefix='/api/2')
app.register_blueprint(datasets, url_prefix='/api/2')
app.register_blueprint(entities, url_prefix='/api/2')
app.register_blueprint(matching, url_prefix='/api/2')


def angular_templates():
    if app.config.get('ASSETS_DEBUG'):
        return
    partials_dir = os.path.join(app.static_folder, 'templates')
    for (root, dirs, files) in os.walk(partials_dir):
        for file_name in files:
            file_path = os.path.join(root, file_name)
            with open(file_path, 'rb') as fh:
Beispiel #3
0
@app.errorhandler(403)
@app.errorhandler(404)
@app.errorhandler(410)
@app.errorhandler(500)
def handle_exceptions(exc):
    """ Re-format exceptions to JSON if accept requires that. """
    format = response_format()
    if format == 'json':
        body = {'status': exc.code,
                'name': exc.name,
                'message': exc.get_description(request.environ)}
        return jsonify(body, status=exc.code,
                       headers=exc.get_headers(request.environ))
    return exc

app.register_blueprint(dataset)
app.register_blueprint(value)
app.register_blueprint(link)
app.register_blueprint(upload)

@app.route('/gh/login')
def login():
    callback=url_for('authorized', _external=True)
    return github.authorize(callback=callback)

@app.route('/gh/logout')
def logout():
    authz.require(authz.logged_in())
    session.clear()
    flash("You've been logged out.", "success")
    return redirect(url_for('index'))
Beispiel #4
0
@app.errorhandler(401)
@app.errorhandler(403)
@app.errorhandler(404)
@app.errorhandler(410)
@app.errorhandler(500)
def handle_exceptions(exc):
    """ Re-format exceptions to JSON if accept requires that. """
    format = response_format()
    if format == "json":
        body = {"status": exc.code, "name": exc.name, "message": exc.get_description(request.environ)}
        return jsonify(body, status=exc.code, headers=exc.get_headers(request.environ))
    return exc


app.register_blueprint(dataset)
app.register_blueprint(entity)
app.register_blueprint(alias)
app.register_blueprint(upload)
app.register_blueprint(reconcile)


@app.route("/gh/login")
def login():
    callback = url_for("authorized", _external=True)
    return github.authorize(callback=callback)


@app.route("/gh/logout")
def logout():
    authz.require(authz.logged_in())
Beispiel #5
0
def handle_exceptions(exc):
    """ Re-format exceptions to JSON if accept requires that. """
    format = response_format()
    if format == 'json':
        body = {
            'status': exc.code,
            'name': exc.name,
            'message': exc.get_description(request.environ)
        }
        return jsonify(body,
                       status=exc.code,
                       headers=exc.get_headers(request.environ))
    return exc


app.register_blueprint(dataset)
app.register_blueprint(entity)
app.register_blueprint(alias)
app.register_blueprint(upload)
app.register_blueprint(reconcile)


@app.route('/gh/login')
def login():
    callback = url_for('authorized', _external=True)
    return github.authorize(callback=callback)


@app.route('/gh/logout')
def logout():
    authz.require(authz.logged_in())