From f8a9fcddb53438c2d11a550ffeab796aaf491b93 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Fri, 24 Aug 2018 11:43:56 +0200 Subject: [PATCH] Adding method to_data() to class ModuleInfo --- lib/webhooks/module_info.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/webhooks/module_info.py b/lib/webhooks/module_info.py index 343821e..b414aff 100644 --- a/lib/webhooks/module_info.py +++ b/lib/webhooks/module_info.py @@ -25,7 +25,7 @@ from .common import pp, to_str, to_bool, is_sequence from .obj import BaseObjectError from .obj import BaseObject -__version__ = '0.4.0' +__version__ = '0.5.0' LOG = logging.getLogger(__name__) @@ -248,6 +248,28 @@ class ModuleInfo(BaseObject): return res + # ------------------------------------------------------------------------- + def to_data(self): + """Returning a dict, which can be used to re-instantiate this module info.""" + + res = {} + + res['name'] = self.name + res['vendor'] = self.vendor + res['full_name'] = self.full_name + res['full_name_orig'] = self.full_name_orig + res['forge_version'] = self.forge_version + res['forge_avail'] = self.forge_avail + res['forge_homepage_url'] = self.forge_homepage_url + res['forge_source'] = self.forge_source + res['repo'] = self.repo + + red['local_versions'] = copy.copy(self.local_versions) + red['expected_versions'] = copy.copy(self.local_versions) + red['forge_releases'] = copy.copy(self.forge_releases) + + return res + # ------------------------------------------------------------------------- def merge_in(self, other): -- 2.39.5