Commit 41333622 authored by Rafael Monnerat's avatar Rafael Monnerat

py3: Import StringIO from six

parent 37098d88
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
from lxml import etree from lxml import etree
from zExceptions import Unauthorized from zExceptions import Unauthorized
import pkg_resources import pkg_resources
import StringIO from six import StringIO
def ComputerConsumptionTioXMLFile_parseXml(self, REQUEST=None): def ComputerConsumptionTioXMLFile_parseXml(self, REQUEST=None):
"""Call bang on self.""" """Call bang on self."""
...@@ -41,11 +41,11 @@ def ComputerConsumptionTioXMLFile_parseXml(self, REQUEST=None): ...@@ -41,11 +41,11 @@ def ComputerConsumptionTioXMLFile_parseXml(self, REQUEST=None):
'slapos.slap', 'doc/computer_consumption.xsd') 'slapos.slap', 'doc/computer_consumption.xsd')
# Validate against the xsd # Validate against the xsd
xsd_model = StringIO.StringIO(compute_node_consumption_model) xsd_model = StringIO(compute_node_consumption_model)
xmlschema_doc = etree.parse(xsd_model) xmlschema_doc = etree.parse(xsd_model)
xmlschema = etree.XMLSchema(xmlschema_doc) xmlschema = etree.XMLSchema(xmlschema_doc)
string_to_validate = StringIO.StringIO(xml) string_to_validate = StringIO(xml)
try: try:
tree = etree.parse(string_to_validate) tree = etree.parse(string_to_validate)
......
...@@ -75,7 +75,7 @@ except ImportError: ...@@ -75,7 +75,7 @@ except ImportError:
from zLOG import LOG, INFO from zLOG import LOG, INFO
import StringIO from six import StringIO
import pkg_resources import pkg_resources
from DateTime import DateTime from DateTime import DateTime
from App.Common import rfc1123_date from App.Common import rfc1123_date
...@@ -771,11 +771,11 @@ class SlapTool(BaseTool): ...@@ -771,11 +771,11 @@ class SlapTool(BaseTool):
def _validateXML(self, to_be_validated, xsd_model): def _validateXML(self, to_be_validated, xsd_model):
"""Will validate the xml file""" """Will validate the xml file"""
#We parse the XSD model #We parse the XSD model
xsd_model = StringIO.StringIO(xsd_model) xsd_model = StringIO(xsd_model)
xmlschema_doc = etree.parse(xsd_model) xmlschema_doc = etree.parse(xsd_model)
xmlschema = etree.XMLSchema(xmlschema_doc) xmlschema = etree.XMLSchema(xmlschema_doc)
string_to_validate = StringIO.StringIO(to_be_validated) string_to_validate = StringIO(to_be_validated)
try: try:
document = etree.parse(string_to_validate) document = etree.parse(string_to_validate)
......
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