ckan.logic.action.update

Functions for updating existing data in CKAN.

ckan.logic.action.update.make_latest_pending_package_active(context, data_dict)

TODO: What does this function do?

You must be authorized to update the dataset.

Parameters:id (string) – the name or id of the dataset, e.g. 'warandpeace'
ckan.logic.action.update.related_update(context, data_dict)

Update a related item.

You must be the owner of a related item to update it.

For further parameters see related_create().

Parameters:id (string) – the id of the related item to update
Returns:the updated related item
Return type:dictionary
ckan.logic.action.update.resource_update(context, data_dict)

Update a resource.

To update a resource you must be authorized to update the dataset that the resource belongs to.

For further parameters see resource_create().

Parameters:id (string) – the id of the resource to update
Returns:the updated resource
Return type:string
ckan.logic.action.update.package_update(context, data_dict)

Update a dataset (package).

You must be authorized to edit the dataset and the groups that it belongs to.

Plugins may change the parameters of this function depending on the value of the dataset’s type attribute, see the IDatasetForm plugin interface.

For further parameters see package_create().

Parameters:id (string) – the name or id of the dataset to update
Returns:the updated dataset (if ‘return_package_dict’ is True in the context, which is the default. Otherwise returns just the dataset id)
Return type:dictionary
ckan.logic.action.update.package_relationship_update(context, data_dict)

Update a relationship between two datasets (packages).

You must be authorized to edit both the subject and the object datasets.

Parameters:
  • id (string) – the id of the package relationship to update
  • subject (string) – the name or id of the dataset that is the subject of the relationship (optional)
  • object – the name or id of the dataset that is the object of the relationship (optional)
  • type (string) – the type of the relationship, one of 'depends_on', 'dependency_of', 'derives_from', 'has_derivation', 'links_to', 'linked_from', 'child_of' or 'parent_of' (optional)
  • comment (string) – a comment about the relationship (optional)
Returns:

the updated relationship

Return type:

dictionary

ckan.logic.action.update.group_update(context, data_dict)

Update a group.

You must be authorized to edit the group.

Plugins may change the parameters of this function depending on the value of the group’s type attribute, see the IGroupForm plugin interface.

For further parameters see group_create().

Parameters:id (string) – the name or id of the group to update
Returns:the updated group
Return type:dictionary
ckan.logic.action.update.organization_update(context, data_dict)

Update a organization.

You must be authorized to edit the organization.

For further parameters see organization_create().

Parameters:id (string) – the name or id of the organization to update
Returns:the updated organization
Return type:dictionary
ckan.logic.action.update.user_update(context, data_dict)

Update a user account.

Normal users can only update their own user accounts. Sysadmins can update any user account.

For further parameters see user_create().

Parameters:id (string) – the name or id of the user to update
Returns:the updated user account
Return type:dictionary
ckan.logic.action.update.task_status_update(context, data_dict)

Update a task status.

Parameters:
  • id (string) – the id of the task status to update
  • entity_id (string) –
  • entity_type (string) –
  • task_type (string) –
  • key (string) –
  • value – (optional)
  • state – (optional)
  • last_updated – (optional)
  • error – (optional)
Returns:

the updated task status

Return type:

dictionary

ckan.logic.action.update.task_status_update_many(context, data_dict)

Update many task statuses at once.

Parameters:data (list of dictionaries) – the task_status dictionaries to update, for the format of task status dictionaries see task_status_update()
Returns:the updated task statuses
Return type:list of dictionaries
ckan.logic.action.update.term_translation_update(context, data_dict)

Create or update a term translation.

You must be a sysadmin to create or update term translations.

Parameters:
  • term (string) – the term to be translated, in the original language, e.g. 'romantic novel'
  • term_translation (string) – the translation of the term, e.g. 'Liebesroman'
  • lang_code (string) – the language code of the translation, e.g. 'de'
Returns:

the newly created or updated term translation

Return type:

dictionary

ckan.logic.action.update.term_translation_update_many(context, data_dict)

Create or update many term translations at once.

Parameters:data (list of dictionaries) – the term translation dictionaries to create or update, for the format of term translation dictionaries see term_translation_update()
Returns:a dictionary with key 'success' whose value is a string stating how many term translations were updated
Return type:string
ckan.logic.action.update.vocabulary_update(context, data_dict)

Update a tag vocabulary.

You must be a sysadmin to update vocabularies.

For further parameters see vocabulary_create().

Parameters:id (string) – the id of the vocabulary to update
Returns:the updated vocabulary
Return type:dictionary
ckan.logic.action.update.user_role_update(context, data_dict)

Update a user or authorization group’s roles for a domain object.

The user parameter must be given.

You must be authorized to update the domain object.

To delete all of a user or authorization group’s roles for domain object, pass an empty list [] to the roles parameter.

Parameters:
  • user (string) – the name or id of the user
  • domain_object (string) – the name or id of the domain object (e.g. a package, group or authorization group)
  • roles (list of strings) – the new roles, e.g. ['editor']
Returns:

the updated roles of all users for the domain object

Return type:

dictionary

ckan.logic.action.update.user_role_bulk_update(context, data_dict)

Update the roles of many users or authorization groups for an object.

You must be authorized to update the domain object.

Parameters:user_roles (list of dictionaries) – the updated user roles, for the format of user role dictionaries see user_role_update()
Returns:the updated roles of all users and authorization groups for the domain object
Return type:dictionary
ckan.logic.action.update.dashboard_mark_activities_old(context, data_dict)

Mark all the authorized user’s new dashboard activities as old.

This will reset dashboard_new_activities_count to 0.

ckan.logic.action.update.send_email_notifications(context, data_dict)

Send any pending activity stream notification emails to users.

You must provide a sysadmin’s API key in the Authorization header of the request, or call this action from the command-line via a paster post ... command.

ckan.logic.action.update.package_owner_org_update(context, data_dict)

Update the owning organization of a dataset

Parameters:
  • id (string) – the name or id of the dataset to update
  • organization_id – the name or id of the owning organization