Update method improved

The base method from oslo is slightly improved to handle the id and
wrapping correctly.

Change-Id: I35e62c76498040c8e7180df400c278dfa766bb70
This commit is contained in:
Nikita Konovalov 2015-01-13 15:32:15 +03:00
parent 2090a8beff
commit a5c1b220ac
1 changed files with 15 additions and 3 deletions

View File

@ -104,9 +104,21 @@ class BaseManager(base.CrudManager):
"""
kwargs = self._filter_kwargs(kwargs)
return self._post(
self.build_url(**kwargs),
kwargs)
return self._post(self.build_url(**kwargs), kwargs)
def update(self, **kwargs):
"""Update a resource.
The default implementation is overridden so that the dictionary is
passed 'as is' without any wrapping. The id field is removed from the
request body.
"""
kwargs = self._filter_kwargs(kwargs)
params = kwargs.copy()
params.pop('id')
return self._put(self.build_url(**kwargs), params)
class BaseNestedManager(BaseManager):