From 70bffdadd594b470752da0d498a759a616031803 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Fri, 4 Jan 2019 17:47:42 +0100 Subject: [PATCH] Adding property tags to class ModuleMetadata --- lib/webhooks/module_meta_info.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/webhooks/module_meta_info.py b/lib/webhooks/module_meta_info.py index ed438a4..f8a59a7 100644 --- a/lib/webhooks/module_meta_info.py +++ b/lib/webhooks/module_meta_info.py @@ -27,7 +27,7 @@ from fb_tools.obj import FbBaseObjectError, FbBaseObject from .xlate import XLATOR -__version__ = '0.5.1' +__version__ = '0.5.2' LOG = logging.getLogger(__name__) @@ -162,6 +162,7 @@ class ModuleMetadata(FbBaseObject): self._project_page = None self._issues_url = None self.operatingsystem_support = [] + self.tags = [] super(ModuleMetadata, self).__init__( appname=appname, verbose=verbose, version=version, @@ -374,6 +375,11 @@ class ModuleMetadata(FbBaseObject): for item in json_data['operatingsystem_support']: supp = ModuleOsSupport.from_data(item) metadata.operatingsystem_support.append(supp) + if 'tags' in json_data: + for tag in json_data['tags']: + tg = str(tag).strip() + if tg: + metadata.tags.append(tg) metadata.initialized = True if verbose > 3: @@ -400,6 +406,8 @@ class ModuleMetadata(FbBaseObject): new.issues_url = self.issues_url for supp in self.operatingsystem_support: new.operatingsystem_support.append(copy.copy(supp)) + for tag in self.tags: + new.tags.append(tag) new.initialized = True @@ -430,6 +438,10 @@ class ModuleMetadata(FbBaseObject): data['operatingsystem_support'] = [] for supp in self.operatingsystem_support: data['operatingsystem_support'].append(supp.to_data()) + if self.tags: + data['tags'] = [] + for tag in self.tags: + data['tags'].append(tag) if self.verbose > 4: LOG.debug("ModuleMetadata:\n{}".format(pp(data))) -- 2.39.5