]> git.llucax.com Git - software/pymin.git/blob - services/dns/host.py
Split dns handler in submodules (refs #2).
[software/pymin.git] / services / dns / host.py
1 # vim: set encoding=utf-8 et sw=4 sts=4 :
2
3 # TODO documentation, validation
4
5 from pymin.seqtools import Sequence
6 from pymin.service.util import DictComposedSubHandler
7
8 __all__ = ('HostHandler',)
9
10 class Host(Sequence):
11     def __init__(self, name, ip):
12         self.name = name
13         self.ip = ip
14     def update(self, ip=None):
15         if ip is not None: self.ip = ip
16     def as_tuple(self):
17         return (self.name, self.ip)
18
19 class HostHandler(DictComposedSubHandler):
20     handler_help = u"Manage DNS hosts"
21     _comp_subhandler_cont = 'zones'
22     _comp_subhandler_attr = 'hosts'
23     _comp_subhandler_class = Host
24