Bug 50600 - Provide dict like interface to udm_ob.props
Provide dict like interface to udm_ob.props
Status: VERIFIED FIXED
Product: Components
Classification: Unclassified
Component: udm-rest-api-client
unspecified
Other Linux
: P5 normal (vote)
: ---
Assigned To: Daniel Tröder
Ole Schwiegert
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-12-05 09:54 CET by Ole Schwiegert
Modified: 2020-01-27 10:10 CET (History)
1 user (show)

See Also:
What kind of report is it?: Feature Request
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ole Schwiegert univentionstaff 2019-12-05 09:54:16 CET
I would like to have a dict-like interface for udm_obj.props. Especially
if 'prop' in udm_obj.props would be an enrichment compared to hasattr.
Comment 1 Daniel Tröder univentionstaff 2019-12-05 11:26:37 CET
Such an interface should then also be added to the Python UDM (non-HTTP) API.
Comment 2 Daniel Tröder univentionstaff 2019-12-09 23:51:31 CET
The BaseObjectProperties class of the 'props' attribute of UdmObjects now inherits and implements the methods of both collections.abc.Mapping and collections.abc.Iterable. It this supports both iteration and item access like a dictionary, including the 'in' operator.

[master 7ed67e8] add Mapping and Iterable interfaces to BaseObjectProperties

All checks passed:
* https://travis-ci.com/univention/python-udm-rest-api-client/builds/140324695
* https://codecov.io/gh/univention/python-udm-rest-api-client/commit/7ed67e82d43208218256cedd2b5053cddcb526af
* https://readthedocs.org/projects/udm-rest-client/builds/
Comment 3 Ole Schwiegert univentionstaff 2020-01-27 10:10:01 CET
Changes added: OK
Tests: OK
Actively used: OK

Thanks for implementing these interfaces. Makes using the client much more easy!