def update_project_raw(id, **kwargs): if utils.contains_only_none_values(kwargs): raise argh.exceptions.CommandError("Updating a Project requires at least one modified field.") to_update = utils.checked_api_call(pnc_api.projects, 'get_specific', id=id).content for key, value in iteritems(kwargs): if value is not None: setattr(to_update, key, value) response = utils.checked_api_call(pnc_api.projects, 'update', id=id, body=to_update) if response: return response.content else: return utils.checked_api_call(pnc_api.projects, 'get_specific', id=id).content
def update_project(id, **kwargs): """ Update an existing Project with new information """ if utils.contains_only_none_values(kwargs): raise argh.exceptions.CommandError( "Updating a Project requires at least one modified field.") to_update = utils.checked_api_call(projects_api, 'get_specific', id=id).content for key, value in iteritems(kwargs): if value is not None: setattr(to_update, key, value) response = utils.checked_api_call(projects_api, 'update', id=id, body=to_update) return response
def update_project(id, **kwargs): """ Update an existing Project with new information """ if not id: logging.error("A Project ID must be specified.") return if utils.contains_only_none_values(kwargs): logging.error("Updating a Project requires at least one modified field.") return response = utils.checked_api_call(projects_api, 'get_specific', id=id) if not response: logging.error("No Project with ID {} exists.".format(id)) return to_update = response.content for key, value in iteritems(kwargs): if value is not None: setattr(to_update, key, value) response = utils.checked_api_call(projects_api, 'update', id=id, body=to_update) return response