]> git.llucax.com Git - software/pymin.git/blobdiff - services/dns/zone.py
Add validation to vpn service (refs #20)
[software/pymin.git] / services / dns / zone.py
index f91fcc7594bba0956d357e8345b67ed9d54a1a2a..2e333828fb3e02650027b65edcc408e1ffcad27d 100644 (file)
@@ -1,24 +1,23 @@
 # vim: set encoding=utf-8 et sw=4 sts=4 :
 
-# TODO documentation, validation
+# TODO documentation
 
-from pymin.seqtools import Sequence
+from pymin.validation import Item, Field, FullyQualifiedHostName
 from pymin.service.util import DictSubHandler
 
 __all__ = ('DnsHandler',)
 
 
-class Zone(Sequence):
-    def __init__(self, name):
-        self.name = name
+class Zone(Item):
+    name = Field(FullyQualifiedHostName(not_empty=True))
+    def __init__(self, *args, **kwargs):
+        Item.__init__(self, *args, **kwargs)
         self.hosts = dict()
         self.mxs = dict()
         self.nss = dict()
         self._add = False
         self._update = False
         self._delete = False
-    def as_tuple(self):
-        return (self.name, self.hosts, self.mxs, self.nss)
 
 class ZoneHandler(DictSubHandler):
     handler_help = u"Manage DNS zones"