small changes to improve python3 compatibility

This commit is contained in:
Marco Cammarata 2016-09-28 09:50:23 +02:00
parent 9ee47e42af
commit a2f6976d6d
1 changed files with 3 additions and 4 deletions

View File

@ -1179,7 +1179,9 @@ class dropObject(object):
return "dropObject with keys %s" % self.keys()
def keys(self):
k = self.__dict__.keys()
# list is needed because in py3 keys() returs a generator (and the sorting
# does noe work)
k = list(self.__dict__.keys());
k.sort()
return k
@ -1191,9 +1193,6 @@ def dict2class(d,recursive=True,cleanNames=True):
"""Return a class that has same attributes/values and
dictionaries key/value
"""
#see if it is indeed a dictionary
if type(d) != types.DictType:
return None
#define a dummy class
c = dropObject()