forbid empty domain names
authorRalf Jung <post@ralfj.de>
Thu, 1 Jan 2015 13:19:01 +0000 (14:19 +0100)
committerRalf Jung <post@ralfj.de>
Thu, 1 Jan 2015 13:19:01 +0000 (14:19 +0100)
zone.py

diff --git a/zone.py b/zone.py
index cc4bd2b293d4e7d83d23ecceef08a8fc769a5de4..d7c23ff2506858d91b648a121c4b7321676a252b 100644 (file)
--- a/zone.py
+++ b/zone.py
@@ -260,6 +260,8 @@ class Zone:
         return column_widths((self.abs_hostname(owner), time(self.getTTL(recordType)), recordType, data), (32, 8, 8))
     
     def abs_hostname(self, name):
+        if name == '':
+            raise Exception("Empty domain name is not valid")
         if name == '.' or name == '@':
             return self._name
         if name.endswith('.'):