[Zodb-checkins] CVS: Zope/lib/python/zdaemon - zdoptions.py:1.24

Chris McDonough chrism at zopemafia.com
Sun Dec 21 18:29:36 EST 2003


Update of /cvs-repository/Zope/lib/python/zdaemon
In directory cvs.zope.org:/tmp/cvs-serv15166

Modified Files:
	zdoptions.py 
Log Message:
Add an ignore_getopt_errs indicator to ZDOptions.realize and tests for the indicator.  If this flag is true, ignore any errors that come out of getopt.  This is used to service interactive configuration from user-supplied scripts under which the command line options and arguments are not meant for ZDOptions and can be
safely ignored.


=== Zope/lib/python/zdaemon/zdoptions.py 1.23 => 1.24 ===
--- Zope/lib/python/zdaemon/zdoptions.py:1.23	Thu Oct  2 14:17:15 2003
+++ Zope/lib/python/zdaemon/zdoptions.py	Sun Dec 21 18:29:05 2003
@@ -185,7 +185,8 @@
             if required:
                 self.required_map[name] = required
 
-    def realize(self, args=None, progname=None, doc=None):
+    def realize(self, args=None, progname=None, doc=None,
+                raise_getopt_errs=True):
         """Realize a configuration.
 
         Optional arguments:
@@ -209,12 +210,16 @@
         self.progname = progname
         self.doc = doc
 
+        self.options = []
+        self.args = []
+
         # Call getopt
         try:
             self.options, self.args = getopt.getopt(
                 args, "".join(self.short_options), self.long_options)
         except getopt.error, msg:
-            self.usage(msg)
+            if raise_getopt_errs:
+                self.usage(msg)
 
         # Check for positional args
         if self.args and not self.positional_args_allowed:




More information about the Zodb-checkins mailing list