Commit 3c4cd011 authored by Aurel's avatar Aurel

do not expect to fing id/gid in xml + add comment about bad code

parent fc742e67
...@@ -560,10 +560,14 @@ class ERP5Conduit(XMLSyncUtilsMixin): ...@@ -560,10 +560,14 @@ class ERP5Conduit(XMLSyncUtilsMixin):
# copy of xml object for modification # copy of xml object for modification
xml = deepcopy(xml) xml = deepcopy(xml)
object_element = xml.find('object') object_element = xml.find('object')
if attribute_name == 'id': try:
del object_element.attrib['gid'] del object_element.attrib['gid']
else: except KeyError:
pass
try:
del object_element.attrib['id'] del object_element.attrib['id']
except KeyError:
pass
object_element.attrib[attribute_name] = new_id object_element.attrib[attribute_name] = new_id
if as_string: if as_string:
return etree.tostring(xml, encoding="utf-8") return etree.tostring(xml, encoding="utf-8")
...@@ -1046,6 +1050,9 @@ class ERP5Conduit(XMLSyncUtilsMixin): ...@@ -1046,6 +1050,9 @@ class ERP5Conduit(XMLSyncUtilsMixin):
""" """
# XXX We can not find an object with remote id # XXX We can not find an object with remote id
if object_id is None: if object_id is None:
# XXX object must be retrieved by their GID, id must not be synchronised
# This hack is wrong, unfortunately all units are based on it so I can
# not remove it, all must be reviewed before
object_id = xml.get('id') object_id = xml.get('id')
if object_id is not None: if object_id is not None:
if sub_object is None: if sub_object is None:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment