Commit 787fa919 authored by Rafael Monnerat's avatar Rafael Monnerat

py3: Fixup _getXmlAsDict

parent 46c182a6
......@@ -30,10 +30,10 @@ from Products.ERP5Type import Permissions
from erp5.component.document.Item import Item
from lxml import etree
import collections
from Products.ERP5Type.Utils import str2bytes, unicode2str, str2unicode
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from erp5.component.module.SlapOSCloud import _assertACI
from Products.ERP5Type.Utils import unicode2str
from zLOG import LOG, INFO
try:
......@@ -66,16 +66,16 @@ class SoftwareInstance(Item):
def _getXmlAsDict(self, xml):
result_dict = {}
if xml:
tree = etree.fromstring(xml)
tree = etree.fromstring(str2bytes(xml))
for element in tree.iterfind('parameter'):
key = element.get('id').encode("UTF-8")
key = str2unicode(element.get('id'))
value = result_dict.get(key, None)
if value is not None:
value = (value + ' ' + element.text)
else:
value = element.text
if value is not None:
value = value.encode("UTF-8")
value = str2unicode(value)
result_dict[key] = value
return result_dict
......
......@@ -36,6 +36,7 @@ from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from Acquisition import aq_base, aq_inner
from slapos.util import dumps
from lxml import etree
from Products.ERP5Type.Utils import str2bytes
def cloneDocumentWithANewPortalType(obj, portal_type):
import erp5.portal_type
......@@ -351,7 +352,7 @@ def isValidXml(self, value, REQUEST=None):
if REQUEST is not None:
raise Unauthorized
# No better way them this for now
etree.fromstring(value)
etree.fromstring(str2bytes(value))
return True
def isValidXmlMarshaller(self, value, REQUEST=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