#!/usr/bin/python
-from types import StringTypes
from lxml import etree
-from StringIO import StringIO
from sfa.util.faults import InvalidXML
from sfa.rspecs.elements.element import Element
+from sfa.util.py23 import StringType
+from sfa.util.py23 import StringIO
+
# helper functions to help build xpaths
class XpathFilter:
@staticmethod
self.namespaces = namespaces
self.default_namespace = None
self.schema = None
- if isinstance(xml, basestring):
+ if isinstance(xml, StringType):
self.parse_xml(xml)
if isinstance(xml, XmlElement):
self.root = xml
if isinstance(val, dict):
child_element = etree.SubElement(element, key)
self.parse_dict(val, key, child_element)
- elif isinstance(val, basestring):
+ elif isinstance(val, StringType):
child_element = etree.SubElement(element, key).text = val
elif isinstance(value, int):
d=d.copy()
# looks like iteritems won't stand side-effects
for k in d.keys():
- if not isinstance(d[k],StringTypes):
+ if not isinstance(d[k], StringType):
del d[k]
element.attrib.update(d)