Commit 13e8519c authored by Nicolas Delaby's avatar Nicolas Delaby

Add temporary management of deleted objects

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15534 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bf73b8da
......@@ -932,11 +932,11 @@ class Subscription(Folder, SyncCode):
xml_mapping = getattr(self, 'xml_mapping', None)
return xml_mapping
def getXMLFromObject(self, object):
def getXMLFromObject(self, object, force=0):
"""
return the xml mapping
"""
xml_mapping = self.getXMLMapping()
xml_mapping = self.getXMLMapping(force=force)
xml = ''
if xml_mapping is not None:
func = getattr(object, xml_mapping, None)
......
......@@ -1090,8 +1090,8 @@ class XMLSyncUtilsMixin(SyncCode):
data_subnode = self.getDataSubNode(action)
if action.nodeName == 'Add':
# Then store the xml of this new subobject
reset = 0
if object is None:
#if object_id is not None:
add_data = conduit.addNode(xml=data_subnode,
object=destination, object_id=object_id)
if add_data['conflict_list'] not in ('', None, []):
......@@ -1103,6 +1103,7 @@ class XMLSyncUtilsMixin(SyncCode):
signature.setPath(object.getPhysicalPath())
signature.setObjectId(object.getId())
else:
reset = 1
#Object was retrieve but need to be updated without recreated
#usefull when an object is only deleted by workflow.
add_data = conduit.addNode(xml=data_subnode,
......@@ -1113,17 +1114,21 @@ class XMLSyncUtilsMixin(SyncCode):
conflict_list += add_data['conflict_list']
if object is not None:
#LOG('SyncModif',0,'addNode, found the object')
#mapping = getattr(object,domain.getXMLMapping(),None)
xml_object = domain.getXMLFromObject(object)
#if mapping is not None:
# xml_object = mapping()
if reset:
#After a reset we want copy the LAST XML view on Signature.
#this implementation is not sufficient, need to be improved.
string_io = StringIO()
PrettyPrint(data_subnode, stream=string_io)
xml_object = string_io.getvalue()
else:
xml_object = domain.getXMLFromObject(object)
signature.setStatus(self.SYNCHRONIZED)
#signature.setId(object.getId())
signature.setPath(object.getPhysicalPath())
signature.setXML(xml_object)
xml_confirmation += self.SyncMLConfirmation(
cmd_id=cmd_id,
cmd='Add',
cmd_id=cmd_id,
cmd='Add',
sync_code=self.ITEM_ADDED,
remote_xml=action)
cmd_id +=1
......
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