From: Frank Brehm Date: Fri, 12 Jan 2018 15:59:40 +0000 (+0100) Subject: Adding property data to class PdnsSoaData X-Git-Tag: 0.1.2~37 X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=9376b82e6945a312037b53a438d65e892483010b;p=pixelpark%2Fadmin-tools.git Adding property data to class PdnsSoaData --- diff --git a/pp_lib/pdns_record.py b/pp_lib/pdns_record.py index 266e717..7801e8e 100644 --- a/pp_lib/pdns_record.py +++ b/pp_lib/pdns_record.py @@ -25,7 +25,7 @@ from .common import pp, compare_fqdn, to_bytes, to_utf8, to_str from .errors import PpError from .obj import PpBaseObjectError, PpBaseObject -__version__ = '0.4.1' +__version__ = '0.4.2' LOG = logging.getLogger(__name__) @@ -306,6 +306,17 @@ class PdnsSoaData(PpBaseObject): return self._ttl = int(value) + # ----------------------------------------------------------- + @property + def data(self): + "String representation of SOA data." + if (self.primary and self.email and self.serial is not None and self.refresh and + self.retry and self.expire and self.ttl): + return "{_primary} {_email} {_serial} {_refresh} {_retry} {_expire} {_ttl}".format( + **self.__dict__) + else: + return None + # ------------------------------------------------------------------------- def as_dict(self, short=True): """ @@ -326,6 +337,7 @@ class PdnsSoaData(PpBaseObject): res['retry'] = self.retry res['expire'] = self.expire res['ttl'] = self.ttl + res['data'] = self.data return res