Skip to content

Commit

Permalink
Fix unexpected setattr on class attribute if constant
Browse files Browse the repository at this point in the history
  • Loading branch information
lmazuel committed Mar 28, 2017
1 parent 5c78216 commit 0a1d109
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions msrest/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,14 @@ def _convert_to_datatype(data, data_type, localtypes):
localtypes) for key in data
}
data = data_obj(**result)
else:
constants = [name for name, config in getattr(data, '_validation', {}).items()
if config.get('constant')]
try:
for attr, map in data._attribute_map.items():
for attr, mapconfig in data._attribute_map.items():
if attr in constants:
continue
setattr(data, attr, _convert_to_datatype(
getattr(data, attr), map['type'], localtypes))
getattr(data, attr), mapconfig['type'], localtypes))
except AttributeError:
pass
return data
Expand Down

0 comments on commit 0a1d109

Please sign in to comment.