示例#1
0
def submit(dataset, sig):
    dataset = Dataset.find(dataset)
    authz.require(authz.dataset_edit(dataset))
    data = request_content()
    entity_col = data.get('entity') or None
    alias_col = data.get('alias') or None
    if not (entity_col or alias_col):
        flash('You need to pick either a alias or entity column!', 'error')
        return map(dataset.name, sig)
    import_upload.delay(dataset.name, sig, request.account.id, entity_col,
                        alias_col)
    flash('Loading data...', 'success')
    return redirect(url_for('dataset.view', dataset=dataset.name))
示例#2
0
def submit(dataset, id):
    dataset = Dataset.find(dataset)
    authz.require(authz.dataset_edit(dataset))
    data = request_content()
    entity_col = data.get('entity') or None
    alias_col = data.get('alias') or None
    if not (entity_col or alias_col):
        flash('You need to pick either a alias or entity column!', 'error')
        return map(dataset.name, id)
    import_upload.delay(dataset.name, id, request.account.id,
                        entity_col, alias_col)
    flash('Loading data...', 'success')
    return redirect(url_for('dataset.view', dataset=dataset.name))
示例#3
0
def submit(dataset, sig):
    dataset = Dataset.find(dataset)
    authz.require(authz.dataset_edit(dataset))
    data = request_content()
    value_col = data.get('value') or None
    link_col = data.get('link') or None
    if not (value_col or link_col):
        flash('You need to pick either a link or value column!', 'error')
        return map(dataset.name, sig)
    import_upload.delay(dataset.name, sig, request.account.id,
            value_col, link_col)
    flash('Loading data...', 'success')
    return redirect(url_for('dataset.view', dataset=dataset.name))
示例#4
0
def process(dataset, id):
    dataset = Dataset.find(dataset)
    authz.require(authz.dataset_edit(dataset))
    upload = Upload.find(dataset, id)
    mapping = request_data()
    mapping['reviewed'] = mapping.get('reviewed') or False
    mapping['columns'] = mapping.get('columns', {})
    fields = mapping['columns'].values()
    for header in mapping['columns'].keys():
        if header not in upload.tab.headers:
            raise Invalid("Invalid header: %s" % header, None, None)    

    if 'name' not in fields and 'id' not in fields:
        raise Invalid("You have not selected a field that definies entity names.", None, None)

    import_upload.delay(upload.id, request.account.id, mapping)
    return jsonify({'status': 'Loading data...'})