]> git.llucax.com Git - software/pymin.git/commitdiff
Split proxy handler in submodules (refs #2).
authorLeandro Lucarella <llucax@gmail.com>
Fri, 20 Jun 2008 21:06:02 +0000 (18:06 -0300)
committerLeandro Lucarella <llucax@gmail.com>
Fri, 20 Jun 2008 21:06:02 +0000 (18:06 -0300)
services/proxy/handler.py
services/proxy/host.py [new file with mode: 0644]
services/proxy/user.py [new file with mode: 0644]

index a2e86e51e6442898bf97ce1f420fa68e3e9a51a4..8653c2de6396000e437c888073ddaa92db0cca9f 100644 (file)
@@ -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):
diff --git a/services/proxy/host.py b/services/proxy/host.py
new file mode 100644 (file)
index 0000000..a871f58
--- /dev/null
@@ -0,0 +1,23 @@
+# vim: set encoding=utf-8 et sw=4 sts=4 :
+
+from pymin.seqtools import Sequence
+from pymin.service.util import DictSubHandler
+
+__all__ = ('HostHandler',)
+
+
+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
+
diff --git a/services/proxy/user.py b/services/proxy/user.py
new file mode 100644 (file)
index 0000000..a3c1612
--- /dev/null
@@ -0,0 +1,27 @@
+# vim: set encoding=utf-8 et sw=4 sts=4 :
+
+import crypt
+
+from pymin.seqtools import Sequence
+from pymin.service.util import DictSubHandler
+
+__all__ = ('UserHandler',)
+
+
+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
+