Univention Bugzilla – Bug 50972
allow setting properties that only exist after enabling an option
Last modified: 2020-03-24 12:03:42 CET
The udm-rest-api-client currently does not support adding a property to an object, if the object didn't have it when retrieved: --------------------------------------------------------------------------- import asyncio from udm_rest_client import UDM async def test(): async with UDM("Administrator", "s3cr3t", "https://<IP>/univention/udm", verify_ssl=False) as udm: obj = await udm.get("users/user").get("uid=test3,cn=users,<basedn>") setattr(obj.props, "school", ["DEMOSCHOOL"]) await obj.save() asyncio.run(test()) --------------------------------------------------------------------------- in test() 3 obj = await udm.get("users/user").get("uid=test3,cn=users,<basedn>") 4 setattr(obj.props, "school", ["DEMOSCHOOL"]) ----> 5 await obj.save() base_http.py in save(self) 630 if isinstance(value, list): 631 new_value = set(value) --> 632 old_value = set(old_obj["properties"][prop]) 633 else: 634 new_value = value KeyError: 'school'
Scenario for this is a deactivated option (maybe added by an app) of an existing object. When off, certain properties would not exist for the object. It should be possible to enable the option and at the same time set the value of the attribute.
It is now possible to set previously not existent properties. 0033c56 Bug #50972: allow setting properties that only exist after enabling an option ce7928b Bug #50972: add test for setting unknown properties 0a2fdd8 Bug #50972: version 0.3.0 A new version (0.3.0) was released on PyPI: * https://test.pypi.org/project/udm-rest-client/0.3.0/#description * https://pypi.org/project/udm-rest-client/0.3.0/ Coverage: https://codecov.io/gh/univention/python-udm-rest-api-client/commit/0a2fdd801cf82c4aedfc7be3a41c3397e95c76ab Documentation: https://udm-rest-client.readthedocs.io/en/stable/ Tests for 3.6, 3.7 and 3.8: https://travis-ci.com/github/univention/python-udm-rest-api-client/builds/153908671