X-Git-Url: https://git.llucax.com/software/pymin.git/blobdiff_plain/f79fe24d7dae27f6cb31745f24256b01755aad8d..05968c86ff71ae5031fd5940cf4807a4b8e71e24:/services/dns/host.py diff --git a/services/dns/host.py b/services/dns/host.py index 20ce0d5..fecd7c6 100644 --- a/services/dns/host.py +++ b/services/dns/host.py @@ -1,20 +1,16 @@ # 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, HostName, IPAddress from pymin.service.util import DictComposedSubHandler __all__ = ('HostHandler',) -class Host(Sequence): - def __init__(self, name, ip): - self.name = name - self.ip = ip - def update(self, ip=None): - if ip is not None: self.ip = ip - def as_tuple(self): - return (self.name, self.ip) + +class Host(Item): + name = Field(HostName(not_empty=True)) + ip = Field(IPAddress(not_empty=True)) class HostHandler(DictComposedSubHandler): handler_help = u"Manage DNS hosts"