diff --git a/bt5/erp5_syncml/DocumentTemplateItem/portal_components/document.erp5.SyncMLSignature.py b/bt5/erp5_syncml/DocumentTemplateItem/portal_components/document.erp5.SyncMLSignature.py index 0aa1bbb82143655a615f990139b8661d685a3109..f3e74562e6d7c29e3ccc4b00a37d8d322db43b16 100644 --- a/bt5/erp5_syncml/DocumentTemplateItem/portal_components/document.erp5.SyncMLSignature.py +++ b/bt5/erp5_syncml/DocumentTemplateItem/portal_components/document.erp5.SyncMLSignature.py @@ -220,12 +220,12 @@ class SyncMLSignature(XMLObject): def getFirstPdataChunk(self, max_len): """ """ - partial_data = self._baseGetPartialData() + partial_data = bytes(self._baseGetPartialData()).decode('utf-8') chunk = partial_data[:max_len] rest_in_queue = partial_data[max_len:] if rest_in_queue is not None: - self.setPartialData(rest_in_queue) - return bytes(chunk) + self.setPartialData(rest_in_queue.encode('utf-8')) + return chunk.encode('utf-8') security.declareProtected(Permissions.ModifyPortalContent, 'setSubscriberXupdate') diff --git a/bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.XMLSyncUtils.py b/bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.XMLSyncUtils.py index 88a2216f02a5e84aec175d3c03cca5ec5f1f9f85..ddbaa3053b95e9ed58b621d31926528f4c4ba485 100644 --- a/bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.XMLSyncUtils.py +++ b/bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.XMLSyncUtils.py @@ -192,13 +192,15 @@ def getXupdateObject(object_xml=None, old_xml=None): def cutXML(xml_string, length=None): """ - Sliced a xml tree a return two fragment + Sliced a xml tree and return two fragments """ if length is None: length = MAX_LEN + if not isinstance(xml_string, six.text_type): + xml_string = xml_string.decode('utf-8') short_string = xml_string[:length] rest_string = xml_string[length:] - xml_string = etree.CDATA(short_string.decode('utf-8')) + xml_string = etree.CDATA(short_string) return xml_string, rest_string class XMLSyncUtilsMixin(object):