python-zeep
python-zeep copied to clipboard
Ensure that CompondValue class as a __values__ attribute in __init__
Looking in valueobjects.py, around here: https://github.com/mvantellingen/python-zeep/blob/c80519ef01216f8e5bcfe8de7995d841e03b0f2a/src/zeep/xsd/valueobjects.py#L91
I see:
class CompoundValue:
"""Represents a data object for a specific xsd:complexType."""
_xsd_type: "ComplexType"
_xsd_elm: "Element"
def __init__(self, *args, **kwargs):
values = OrderedDict()
# Can be done after unpickle
if self._xsd_type is None:
return
# <omit>
self.__values__ = values
Since there's an early return, the self.__values__
attribute does not exist.
Looking at the rest of the class, I see that many of the dunder methods are looking for self.__values__
attribute (ex: __repr__
looks for it)
It could be the cause for #1155 and a similar error that I am seeing. In my case, my code is hitting __repr__
and the object doesn't have __values__
attribute yet.
I think the fix is to ensure that __values__
attribute exists before returning from __init__