From 9376b82e6945a312037b53a438d65e892483010b Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Fri, 12 Jan 2018 16:59:40 +0100 Subject: [PATCH] Adding property data to class PdnsSoaData --- pp_lib/pdns_record.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 -- 2.39.5