Skip to content

Commit

Permalink
fix not detecting changes in mutable property values
Browse files Browse the repository at this point in the history
  • Loading branch information
dansan committed Dec 14, 2019
1 parent 7c5f651 commit 47a07e8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
History
=======

0.2.1 (2019-12-14)
------------------

* fix not detecting changes in mutable property values

0.2.0 (2019-12-10)
------------------

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.2.0
current_version = 0.2.1
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@
python_requires=">=3.6",
scripts=["update_openapi_client"],
url="https://github.com/univention/python-udm-rest-api-client",
version="0.2.0",
version="0.2.1",
zip_safe=False,
)
2 changes: 1 addition & 1 deletion udm_rest_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@
]
__author__ = """Daniel Troeder"""
__email__ = "troeder@univention.de"
__version__ = "0.2.0"
__version__ = "0.2.1"
4 changes: 4 additions & 0 deletions udm_rest_client/base_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import re
import time
import warnings
from collections.abc import MutableMapping, MutableSequence
from functools import lru_cache
from typing import Any, AsyncIterator, Dict, List, Pattern, Tuple, TypeVar, Union, cast
from urllib.parse import SplitResult, unquote, urljoin, urlsplit
Expand Down Expand Up @@ -817,6 +818,9 @@ async def _copy_from_api_instance_obj(self, api_model_obj: ApiModel) -> None:
DnPropertyEncoder(k, dn, self._udm_module.session).decode()
for dn in v
]
elif isinstance(v, MutableSequence) or isinstance(v, MutableMapping):
# changing obj.property.x should not change obj._api_obj.property.x
v = copy.deepcopy(v)
setattr(self.props, k, v)
superordinate: str = getattr(api_model_obj, "superordinate", None)
if (
Expand Down

0 comments on commit 47a07e8

Please sign in to comment.