# Third party modules
# Own modules
-from .common import pp, to_bytes
+from .common import pp, to_bytes, to_utf8
from .errors import PpError
from .obj import PpBaseObjectError, PpBaseObject
-__version__ = '0.1.2'
+__version__ = '0.2.1'
LOG = logging.getLogger(__name__)
# -----------------------------------------------------------
@property
def name(self):
- """The kname of the zone."""
+ """The name of the zone."""
return getattr(self, '_name', None)
@name.setter
else:
self._name = None
+ # -----------------------------------------------------------
+ @property
+ def name_unicode(self):
+ """The name of the zone in unicode, if it is an IDNA encoded zone."""
+ n = getattr(self, '_name', None)
+ if n is None:
+ return None
+ if 'xn--' in n:
+ return to_utf8(n).decode('idna')
+ return n
+
# -----------------------------------------------------------
@property
def notified_serial(self):
res['last_check'] = self.last_check
res['masters'] = copy.copy(self.masters)
res['name'] = self.name
+ res['name_unicode'] = self.name_unicode
res['notified_serial'] = self.notified_serial
res['serial'] = self.serial
res['url'] = self.url
tpl = self.get_list_template()
params = {
- 'name': self.name,
+ 'name': self.name_unicode,
'len_zone': len_zone,
'kind': self.kind,
'serial': self.serial,