def package_update(context, data_dict): mapped_resources = [] if 'resources' in data_dict: for resource in data_dict['resources']: mapped_resource = generate_mapping(context, resource) mapped_resources.append(mapped_resource) data_dict['resources'] = mapped_resources package_dict = update.package_update(context, data_dict) if package_dict['type'] == 'dataset': send_dataset_log(context, package_dict, 'Dataset updated', 'DatasetMetadataUpdated') update_de(package_dict) return package_dict
def package_create(context, data_dict): if type(data_dict) is dict: log.debug('Creating mapping...') mapped_resources = [] if 'resources' in data_dict: for resource in data_dict['resources']: mapped_resource = generate_mapping(context, resource) mapped_resources.append(mapped_resource) data_dict['resources'] = mapped_resources package_dict = create.package_create(context, data_dict) package = None if type(package_dict) is not dict: package = get.package_show(context, {'id': package_dict}) else: package = get.package_show(context, {'id': package_dict['id']}) if package is not None: if package['type'] == 'dataset': send_dataset_log(context, package, 'Dataset created', 'DatasetPublished') update_de(package) return package_dict