se crea legal monetary total
FossilOrigin-Name: 8ae3dfadfe9b90b8cc5ad59d2a73f4c8a987c5aac498573e56754a2d32e9e2ae
This commit is contained in:
@@ -19,7 +19,7 @@ class ModelBase(object, metaclass=ModelMeta):
|
||||
obj = super().__new__(cls, *args, **kwargs)
|
||||
obj._xml_attributes = {}
|
||||
obj._fields = {}
|
||||
obj._text = ""
|
||||
obj._value = None
|
||||
obj._namespace_prefix = None
|
||||
obj._on_change_fields = defaultdict(list)
|
||||
obj._order_fields = []
|
||||
@@ -72,7 +72,7 @@ class ModelBase(object, metaclass=ModelMeta):
|
||||
def _set_content(self, value):
|
||||
default = self.__default_set__(value)
|
||||
if default is not None:
|
||||
self._text = str(default)
|
||||
self._value = default
|
||||
|
||||
def _hook_before_xml(self):
|
||||
self.__before_xml__()
|
||||
@@ -116,7 +116,9 @@ class ModelBase(object, metaclass=ModelMeta):
|
||||
content += value.to_xml()
|
||||
elif isinstance(value, str):
|
||||
content += value
|
||||
content += self._text
|
||||
|
||||
if self._value is not None:
|
||||
content += str(self._value)
|
||||
|
||||
if content == "":
|
||||
return "<%s%s%s/>" % (ns, tag, attributes)
|
||||
|
||||
@@ -17,9 +17,10 @@ class _RelationProxy():
|
||||
def __setattr__(self, attr, value):
|
||||
# TODO(bit4bit) hacemos proxy al sistema de notificacion de cambios
|
||||
# algo burdo, se usa __dict__ para saltarnos el __getattr__ y generar un fallo por recursion
|
||||
response = setattr(self._obj, attr, value)
|
||||
for fun in self.__dict__['_inst']._on_change_fields[self.__dict__['_attribute']]:
|
||||
fun(self.__dict__['_inst'], self.__dict__['_attribute'], value)
|
||||
return setattr(self._obj, attr, value)
|
||||
return response
|
||||
|
||||
class _Relation():
|
||||
def __init__(self, creator, inst, attribute):
|
||||
|
||||
Reference in New Issue
Block a user