Commit 496d4f42 authored by root's avatar root

Fix DictMix missing in py3

parent fe0f3657
...@@ -9,7 +9,6 @@ for JSON/XML/YAML output ...@@ -9,7 +9,6 @@ for JSON/XML/YAML output
import collections import collections
import logging import logging
import json import json
from UserDict import DictMixin
from twisted.python import log from twisted.python import log
primitives = (int, long, float, bool, str,unicode) primitives = (int, long, float, bool, str,unicode)
...@@ -20,7 +19,7 @@ def convertForSerialization(obj): ...@@ -20,7 +19,7 @@ def convertForSerialization(obj):
if type(obj) in primitives: if type(obj) in primitives:
# no conversion # no conversion
return obj return obj
elif isinstance(obj, dict) or isinstance(obj,DictMixin): elif isinstance(obj, dict):
return traverseDict(obj) return traverseDict(obj)
elif isClassInstance(obj): elif isClassInstance(obj):
return convertClassToDict(obj) return convertClassToDict(obj)
...@@ -66,7 +65,7 @@ def convertToJson(obj): ...@@ -66,7 +65,7 @@ def convertToJson(obj):
def generateXml(obj): def generateXml(obj):
"""Generates basic XML from an object that has already been converted for serialization""" """Generates basic XML from an object that has already been converted for serialization"""
if isinstance(obj, dict) or isinstance(obj,DictMixin): if isinstance(obj, dict):
return getXML_dict(obj, "item") return getXML_dict(obj, "item")
elif isinstance(obj,collections.Iterable): elif isinstance(obj,collections.Iterable):
return "<list>%s</list>" % getXML(obj, "item") return "<list>%s</list>" % getXML(obj, "item")
......
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