fix: Add support for namespaces in Galaxies

pull/3/head
Raphaël Vinot 2018-05-23 14:24:05 +02:00
parent 994f4e779a
commit 9d71c04cf3
1 changed files with 6 additions and 2 deletions

View File

@ -50,13 +50,17 @@ class Galaxy():
self.description = self.galaxy['description'] self.description = self.galaxy['description']
self.version = self.galaxy['version'] self.version = self.galaxy['version']
self.uuid = self.galaxy['uuid'] self.uuid = self.galaxy['uuid']
self.namespace = self.galaxy.pop('namespace', None)
def to_json(self): def to_json(self):
return json.dumps(self, cls=EncodeGalaxies) return json.dumps(self, cls=EncodeGalaxies)
def to_dict(self): def to_dict(self):
return {'type': self.type, 'name': self.name, 'description': self.description, to_return = {'type': self.type, 'name': self.name, 'description': self.description,
'version': self.version, 'uuid': self.uuid, 'icon': self.icon} 'version': self.version, 'uuid': self.uuid, 'icon': self.icon}
if self.namespace:
to_return['namespace'] = self.namespace
return to_return
class Galaxies(collections.Mapping): class Galaxies(collections.Mapping):