From: Frank Brehm Date: Tue, 26 Feb 2019 09:24:15 +0000 (+0100) Subject: Adding definition of properties 'file_md5', 'license' and 'metadata' of class Current... X-Git-Tag: 1.6.4^2~50 X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=ccaeed5635629b7a52a6d5e2c54681b9e2e80942;p=pixelpark%2Fpuppetmaster-webhooks.git Adding definition of properties 'file_md5', 'license' and 'metadata' of class CurrentModuleReleaseInfo --- diff --git a/lib/webhooks/forge_module_info.py b/lib/webhooks/forge_module_info.py index d24a45a..8065e63 100644 --- a/lib/webhooks/forge_module_info.py +++ b/lib/webhooks/forge_module_info.py @@ -29,7 +29,9 @@ from .xlate import XLATOR from .base_module_info import BaseModuleInfoError, BaseModuleInfo -__version__ = '0.5.1' +from .module_meta_info import ModuleMetadata + +__version__ = '0.5.2' LOG = logging.getLogger(__name__) @@ -398,7 +400,7 @@ class CurrentModuleReleaseInfo(ModuleReleaseInfo): # ------------------------------------------------------------------------- @property def deleted_for(self): - """The reason, why this module release was deleted..""" + """The reason, why this module release was deleted.""" return self._deleted_for @deleted_for.setter @@ -431,6 +433,39 @@ class CurrentModuleReleaseInfo(ModuleReleaseInfo): LOG.error(_("Got a {c} setting {w}: {e}").format( c=e.__class__.__name__, w='downloads', e=e)) + # ------------------------------------------------------------------------- + @property + def file_md5(self): + """The MD5-sum of the current release package.""" + return self._file_md5 + + @file_md5.setter + def file_md5(self, value): + if value is None: + self._file_md5 = None + return + v = str(value).strip() + if v == '': + self._file_md5 = None + return + self._file_md5 = v + + # ------------------------------------------------------------------------- + @property + def license(self): + """The license of module source.""" + return self._license + + @license.setter + def license(self, value): + if value is None: + self._license = None + return + v = str(value).strip() + if v == '': + self._license = None + return + self._license = v # ------------------------------------------------------------------------- def as_dict(self, short=True): @@ -446,6 +481,8 @@ class CurrentModuleReleaseInfo(ModuleReleaseInfo): res['changelog'] = self.changelog res['deleted_for'] = self.deleted_for res['downloads'] = self.downloads + res['file_md5'] = self.file_md5 + res['license'] = self.license return res @@ -460,7 +497,15 @@ class CurrentModuleReleaseInfo(ModuleReleaseInfo): self.deleted_for = data['deleted_for'] if 'downloads' in data and data['downloads']: self.downloads = data['downloads'] - + if 'file_md5' in data and data['file_md5']: + self.file_md5 = data['file_md5'] + if 'license' in data and data['license']: + self.license = data['license'] + + if 'metadata' in data and data['metadata']: + self.metadata = ModuleMetadata.from_json_data( + data['metadata'], appname=self.appname, + verbose=self.verbose, base_dir=self.base_dir) # ============================================================================= class ModuleReleaseList(collections.MutableSequence, FbBaseObject):