def update(self, resource_id, **fields):
        """Updates a Resource object by resource id (can be either integer id or string identifier)"""
        if self.resource_class.query_update is None or self.resource_class.container_update is None:
            raise ResourceBadMethodError

        if not fields:
            raise ResourceNoFieldsProvidedError

        formatter = MemorizeFormatter()

        if is_unicode(resource_id):
            resource_id = to_string(resource_id)

        try:
            query_update = formatter.format(self.resource_class.query_update, resource_id, **fields)
        except KeyError as exception:
            param = str(exception).replace("'", "")

            if param in self.params:
                fields[param] = self.params[param]
                query_update = formatter.format(self.resource_class.query_update, resource_id, **fields)
            else:
                raise ValidationError('{0} argument is required'.format(exception))

        url = '{0}{1}'.format(self.redmine.url, query_update)
        data = {self.resource_class.container_update: self.prepare_params(formatter.unused_kwargs)}

        if 'uploads' in data[self.resource_class.container_update]:
            data['attachments'] = data[self.resource_class.container_update].pop('uploads')
            for index, attachment in enumerate(data['attachments']):
                data['attachments'][index]['token'] = self.redmine.upload(attachment.get('path', ''))

        return self.redmine.request('put', url, data=data)
dataset/ETHPy150Open maxtepkeev/python-redmine/redmine/managers.py/ResourceManager.update/original