X-Git-Url: https://git.llucax.com/software/pymin.git/blobdiff_plain/fd09c4a43a9c0155e5b418246ca7f72632eefd8a..4bc9f563607e11cbc49c81ff23f8a3d486d3b202:/services/proxy/handler.py diff --git a/services/proxy/handler.py b/services/proxy/handler.py index a2e86e5..8653c2d 100644 --- a/services/proxy/handler.py +++ b/services/proxy/handler.py @@ -1,49 +1,16 @@ # vim: set encoding=utf-8 et sw=4 sts=4 : from os import path -import crypt import logging ; log = logging.getLogger('pymin.services.proxy') -from pymin.seqtools import Sequence -from pymin.dispatcher import Handler, handler, HandlerError from pymin.service.util import Restorable, ConfigWriter, InitdHandler, \ - TransactionalHandler, ParametersHandler, \ - DictSubHandler + TransactionalHandler, ParametersHandler -__all__ = ('ProxyHandler') +from host import HostHandler +from user import UserHandler +__all__ = ('ProxyHandler',) -class Host(Sequence): - def __init__(self,ip): - self.ip = ip - def as_tuple(self): - return (self.ip,) - -# TODO convert to a SetSubHandler - -class HostHandler(DictSubHandler): - - handler_help = u"Manage proxy hosts" - - _cont_subhandler_attr = 'hosts' - _cont_subhandler_class = Host - -class User(Sequence): - def __init__(self, name, password): - self.name = name - self.password = crypt.crypt(password,'BA') - def as_tuple(self): - return (self.name, self.password) - def update(self, password=None): - if password is not None: - self.password = crypt.crypt(password,'BA') - -class UserHandler(DictSubHandler): - - handler_help = u"Manage proxy users" - - _cont_subhandler_attr = 'users' - _cont_subhandler_class = User class ProxyHandler(Restorable, ConfigWriter, InitdHandler, TransactionalHandler, ParametersHandler):