Example #1
0
File: create.py Project: zydio/ckan
def package_relationship_create_rest(context, data_dict):
    # rename keys
    key_map = {'id': 'subject',
               'id2': 'object',
               'rel': 'type'}
    # Don't be destructive to enable parameter values for
    # object and type to override the URL parameters.
    data_dict = rename_keys(data_dict, key_map, destructive=False)

    relationship_dict = package_relationship_create(context, data_dict)
    return relationship_dict
Example #2
0
File: delete.py Project: zydio/ckan
def package_relationship_delete_rest(context, data_dict):

    # rename keys
    key_map = {'id': 'subject',
               'id2': 'object',
               'rel': 'type'}
    # We want 'destructive', so that the value of the subject,
    # object and rel in the URI overwrite any values for these
    # in params. This is because you are not allowed to change
    # these values.
    data_dict = rename_keys(data_dict, key_map, destructive=True)

    package_relationship_delete(context, data_dict)
Example #3
0
File: update.py Project: zydio/ckan
def package_relationship_update_rest(context, data_dict):

    # rename keys
    key_map = {"id": "subject", "id2": "object", "rel": "type"}

    # We want 'destructive', so that the value of the subject,
    # object and rel in the URI overwrite any values for these
    # in params. This is because you are not allowed to change
    # these values.
    data_dict = rename_keys(data_dict, key_map, destructive=True)

    relationship_dict = package_relationship_update(context, data_dict)

    return relationship_dict