Use a default value to get a XML from Signature in XMLSyncUtils

Use a default namespace to retrieve the Status


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30054 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cb632afa
......@@ -194,7 +194,7 @@ class Signature(Folder, SyncCode, File):
else:
self.xml = None
def getXML(self):
def getXML(self, default=None):
"""
get the XML corresponding to the object
"""
......@@ -207,7 +207,7 @@ class Signature(Folder, SyncCode, File):
else:
raise ValueError, "the self.xml haven't good type"
else:
return None
return default
def hasTempXML(self):
"""
......@@ -227,7 +227,7 @@ class Signature(Folder, SyncCode, File):
else:
self.temp_xml = None
def getTempXML(self):
def getTempXML(self, default=None):
"""
get the temp xml
"""
......@@ -239,7 +239,7 @@ class Signature(Folder, SyncCode, File):
else:
raise ValueError, "the self.xml haven't good type"
else:
return None
return default
def setSubscriberXupdate(self, xupdate):
"""
......@@ -411,7 +411,7 @@ class Signature(Folder, SyncCode, File):
return ''.join(chunk)
def getPartialXML(self):
def getPartialXML(self, default=None):
"""
Set the partial string we will have to
deliver in the future
......@@ -422,7 +422,7 @@ class Signature(Folder, SyncCode, File):
else:
raise ValueError, "the self.xml haven't good type"
else:
return None
return default
def getAction(self):
"""
......
......@@ -614,7 +614,7 @@ class XMLSyncUtilsMixin(SyncCode):
the data are : cmd, code and source
"""
status_list = []
status_node_list = xml.xpath('//syncml:Status')
status_node_list = xml.xpath('//syncml:Status', namespaces=xml.nsmap)
for status in status_node_list:
tmp_dict = {}
tmp_dict['cmd'] = '%s' % status.xpath('string(./syncml:Cmd)',
......@@ -878,7 +878,7 @@ class XMLSyncUtilsMixin(SyncCode):
cmd='Replace'))
signature.setStatus(self.SYNCHRONIZED)
elif signature.getStatus() == self.PARTIAL:
xml_string = signature.getPartialXML()
xml_string = signature.getPartialXML(default='')
if(subscriber.getMediaType() != self.MEDIA_TYPE['TEXT_XML']):
xml_to_send = conduit.getXMLFromObjectWithId(object,\
xml_mapping=domain.getXMLMapping())
......
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