api: handle case where metadata is None
This fixes bug #1158808 Change-Id: Ib63f42417262544b12f3cdf267d3c2f2eb47746a Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
@@ -194,9 +194,11 @@ def _flatten_metadata(metadata):
|
||||
"""Return flattened resource metadata without nested structures
|
||||
and with all values converted to unicode strings.
|
||||
"""
|
||||
return dict((k, unicode(v))
|
||||
for k, v in metadata.iteritems()
|
||||
if type(v) not in set([list, dict, set]))
|
||||
if metadata:
|
||||
return dict((k, unicode(v))
|
||||
for k, v in metadata.iteritems()
|
||||
if type(v) not in set([list, dict, set]))
|
||||
return {}
|
||||
|
||||
|
||||
class Sample(wtypes.Base):
|
||||
|
||||
Reference in New Issue
Block a user