From 9d71c04cf30e2afb22b78e88702966f0de6ed53e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 23 May 2018 14:24:05 +0200 Subject: [PATCH] fix: Add support for namespaces in Galaxies --- pymispgalaxies/api.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pymispgalaxies/api.py b/pymispgalaxies/api.py index 661e6fc..46bdcd5 100644 --- a/pymispgalaxies/api.py +++ b/pymispgalaxies/api.py @@ -50,13 +50,17 @@ class Galaxy(): self.description = self.galaxy['description'] self.version = self.galaxy['version'] self.uuid = self.galaxy['uuid'] + self.namespace = self.galaxy.pop('namespace', None) def to_json(self): return json.dumps(self, cls=EncodeGalaxies) def to_dict(self): - return {'type': self.type, 'name': self.name, 'description': self.description, - 'version': self.version, 'uuid': self.uuid, 'icon': self.icon} + to_return = {'type': self.type, 'name': self.name, 'description': self.description, + 'version': self.version, 'uuid': self.uuid, 'icon': self.icon} + if self.namespace: + to_return['namespace'] = self.namespace + return to_return class Galaxies(collections.Mapping):