Convert unicode to six in heat/engine
This patch converts unicode to six.text_type in heat/engine for python 3.x compatibility. Change-Id: I8395582c7e504ff7b710cb5f6034c2f8b6bc8957
This commit is contained in:
parent
f690f8d599
commit
15ea5e132e
@ -89,7 +89,7 @@ class Node(object):
|
||||
|
||||
def __unicode__(self):
|
||||
'''Return a human-readable string representation of the node.'''
|
||||
text = '{%s}' % ', '.join(unicode(n) for n in self)
|
||||
text = '{%s}' % ', '.join(six.text_type(n) for n in self)
|
||||
return encodeutils.safe_decode(text)
|
||||
|
||||
def __repr__(self):
|
||||
@ -148,7 +148,7 @@ class Graph(collections.defaultdict):
|
||||
|
||||
def __unicode__(self):
|
||||
'''Convert the graph to a human-readable string.'''
|
||||
pairs = ('%s: %s' % (unicode(k), unicode(v))
|
||||
pairs = ('%s: %s' % (six.text_type(k), six.text_type(v))
|
||||
for k, v in six.iteritems(self))
|
||||
text = '{%s}' % ', '.join(pairs)
|
||||
return encodeutils.safe_decode(text)
|
||||
@ -245,7 +245,7 @@ class Dependencies(object):
|
||||
'''
|
||||
Return a human-readable string representation of the dependency graph
|
||||
'''
|
||||
return unicode(self._graph)
|
||||
return six.text_type(self._graph)
|
||||
|
||||
def __repr__(self):
|
||||
'''Return a string representation of the object.'''
|
||||
|
@ -391,10 +391,10 @@ class Resource(object):
|
||||
if self.resource_id:
|
||||
text = '%s "%s" [%s] %s' % (self.__class__.__name__, self.name,
|
||||
self.resource_id,
|
||||
unicode(self.stack))
|
||||
six.text_type(self.stack))
|
||||
else:
|
||||
text = '%s "%s" %s' % (self.__class__.__name__, self.name,
|
||||
unicode(self.stack))
|
||||
six.text_type(self.stack))
|
||||
else:
|
||||
text = '%s "%s"' % (self.__class__.__name__, self.name)
|
||||
return encodeutils.safe_decode(text)
|
||||
@ -1014,14 +1014,14 @@ class Resource(object):
|
||||
:results: the id or name of the resource.
|
||||
'''
|
||||
if self.resource_id is not None:
|
||||
return unicode(self.resource_id)
|
||||
return six.text_type(self.resource_id)
|
||||
else:
|
||||
return unicode(self.name)
|
||||
return six.text_type(self.name)
|
||||
|
||||
def physical_resource_name_or_FnGetRefId(self):
|
||||
res_name = self.physical_resource_name()
|
||||
if res_name is not None:
|
||||
return unicode(res_name)
|
||||
return six.text_type(res_name)
|
||||
else:
|
||||
return Resource.FnGetRefId(self)
|
||||
|
||||
|
@ -122,7 +122,7 @@ class ExceptionGroup(Exception):
|
||||
for ex in self.exceptions]).encode('utf-8')
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(map(unicode, self.exceptions))
|
||||
return six.text_type(map(six.text_type, self.exceptions))
|
||||
|
||||
|
||||
class TaskRunner(object):
|
||||
|
Loading…
Reference in New Issue
Block a user