[Zodb-checkins] CVS: ZODB3/ZEO - runzeo.py:1.3

Guido van Rossum guido@python.org
Fri, 17 Jan 2003 13:12:25 -0500


Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv29290

Modified Files:
	runzeo.py 
Log Message:
Refactor ZEOOptions into a reusable mixin and a ZEO-specific class.


=== ZODB3/ZEO/runzeo.py 1.2 => 1.3 ===
--- ZODB3/ZEO/runzeo.py:1.2	Fri Jan 17 12:16:22 2003
+++ ZODB3/ZEO/runzeo.py	Fri Jan 17 13:12:22 2003
@@ -46,7 +46,7 @@
     obj = ZConfig.datatypes.SocketAddress(arg)
     return obj.family, obj.address
 
-class ZEOOptions(ZDOptions):
+class ZEOOptionsMixin:
 
     storages = None
 
@@ -74,13 +74,9 @@
         conf = FileStorage(FSConfig(name, arg))
         self.storages.append(conf)
 
-    def __init__(self):
-        self.schemadir = os.path.dirname(__file__)
-        ZDOptions.__init__(self)
+    def add_zeo_options(self):
         self.add(None, None, "a:", "address=", self.handle_address)
         self.add(None, None, "f:", "filename=", self.handle_filename)
-        self.add("storages", "storages",
-                 required="no storages specified; use -f or -C")
         self.add("family", "zeo.address.family")
         self.add("address", "zeo.address.address",
                  required="no server address specified; use -a or -C")
@@ -91,12 +87,6 @@
         self.add("monitor_address", None, "m:", "monitor=",
                  self.handle_monitor_address)
 
-    def realize(self, *args):
-        ZDOptions.realize(self, *args)
-        if self.args:
-            self.usage("positional arguments are not supported")
-        self.load_logconf()
-
     def load_logconf(self):
         if self.configroot.logger is not None:
             zLOG.set_initializer(self.log_initializer)
@@ -109,7 +99,22 @@
             if hasattr(handler, "reopen"):
                 handler.reopen()
         EventLogger.event_logger.logger = logger
-    
+
+
+class ZEOOptions(ZDOptions, ZEOOptionsMixin):
+
+    def __init__(self):
+        self.schemadir = os.path.dirname(__file__)
+        ZDOptions.__init__(self)
+        self.add_zeo_options()
+        self.add("storages", "storages",
+                 required="no storages specified; use -f or -C")
+
+    def realize(self, *args):
+        ZDOptions.realize(self, *args)
+        if self.configroot is not None:
+            self.load_logconf()
+
 
 class ZEOServer: