1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 18:21:12 +03:00

AC-505 Don't return regions/tags as list of strings for now.

This commit is contained in:
Chris Church 2013-10-08 01:05:49 -04:00
parent a9b84d4a5c
commit 9325dbc846

View File

@ -638,11 +638,11 @@ class InventorySourceSerializer(BaseSerializer):
if field in ret and unicode(ret[field]).startswith('$encrypted$'):
ret[field] = '$encrypted$'
# Make regions/tags into a list of strings.
for field in ('source_regions', 'source_tags'):
if field in ret:
value = ret[field]
if isinstance(value, basestring):
ret[field] = [x.strip() for x in value.split(',') if x.strip()]
#for field in ('source_regions', 'source_tags'):
# if field in ret:
# value = ret[field]
# if isinstance(value, basestring):
# ret[field] = [x.strip() for x in value.split(',') if x.strip()]
return ret
def restore_object(self, attrs, instance=None):
@ -650,7 +650,10 @@ class InventorySourceSerializer(BaseSerializer):
for field in InventorySource.PASSWORD_FIELDS:
if unicode(attrs.get(field, '')).startswith('$encrypted$'):
attrs.pop(field, None)
# FIXME: Accept list of strings for regions/tags.
#for field in ('source_regions', 'source_tags'):
# value = attrs.get(field, [])
# if isinstance(value, (list,tuple)):
# attrs[field] = ','.join([unicode(x).strip() for x in value])
instance = super(InventorySourceSerializer, self).restore_object(attrs, instance)
return instance