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