Example #1
0
def dataverse_publish_dataset(node_addon, auth, **kwargs):
    node = node_addon.owner
    publish_both = request.json.get('publish_both', False)

    now = timezone.now()

    connection = client.connect_from_settings_or_401(node_addon)

    dataverse = client.get_dataverse(connection, node_addon.dataverse_alias)
    dataset = client.get_dataset(dataverse, node_addon.dataset_doi)

    if publish_both:
        client.publish_dataverse(dataverse)
    client.publish_dataset(dataset)

    # Add a log
    node.add_log(
        action='dataverse_dataset_published',
        params={
            'project': node.parent_id,
            'node': node._id,
            'dataset': dataset.title,
        },
        auth=auth,
        log_date=now,
    )

    return {'dataset': dataset.title}, http.OK
Example #2
0
def dataverse_publish_dataset(node_addon, auth, **kwargs):
    node = node_addon.owner
    publish_both = request.json.get('publish_both', False)

    now = timezone.now()

    connection = client.connect_from_settings_or_401(node_addon)

    dataverse = client.get_dataverse(connection, node_addon.dataverse_alias)
    dataset = client.get_dataset(dataverse, node_addon.dataset_doi)

    if publish_both:
        client.publish_dataverse(dataverse)
    client.publish_dataset(dataset)

    # Add a log
    node.add_log(
        action='dataverse_dataset_published',
        params={
            'project': node.parent_id,
            'node': node._id,
            'dataset': dataset.title,
        },
        auth=auth,
        log_date=now,
    )

    return {'dataset': dataset.title}, http.OK