Closed heieisch closed 9 months ago
@heieisch Thanks for the report! Are you able to open a pr to solve this problem?
I probably am. From looking a few minutes into it it seems that the to_dict()
method only outputs allowed_params
and version
is not one of them. Therefore the requester is missing this information.
Updating the self_dict
, with the version key an value, in the update()
function before the args update seems to be an hacky solution.
def update(self, **args):
"""
Update the current :class:`InstanceResource`
"""
self_dict = self.to_dict()
if args:
self_dict = dict(list(self_dict.items()) + list(args.items()))
response = self.requester.put("/{endpoint}/{id}", endpoint=self.endpoint, id=self.id, payload=self_dict)
obj_json = response.json()
if "version" in obj_json:
self.__dict__["version"] = obj_json["version"]
return self
@protoroto Do you have a better idea how to get the. values to the requester?
@heieisch I'll try to look into this tomorrow and I'll let you know! Thanks again!
@heieisch Maybe adding version
to the WikiPage
allowed_params
could be the right thing to do?
Yes that would be an option. I do not know the implications of adding it to allowed_params
but doing so solves the Issue.
@heieisch I'll discuss this with @yakky and let you know as soon as possible
@heieisch After discussing this with @yakky , we think that it is perfectly safe to add version
to WikiPage
allowed_params
. If you open a pr I'll be happy to review it and merge/release a new version as soon as possible.
Description
when updating the content of an wiki Page the update fails unless you give the Version of the page as a parameter
Steps to reproduce
Versions
python taiga 1.1.0 (2023-04-23) python 3.9, 3.10 tested on Windows 11, Mac OS 13 and Fedora 38
Expected behaviour
Update of wiki Page without error
Actual behaviour
Additional information
using
wiki_page.update(version=wiki_page.version)
it works seamlessly