[Zope-Checkins] CVS: Zope/lib/python/zdaemon - zdoptions.py:1.22.16.2

Chris McDonough chrism at zopemafia.com
Sun Dec 21 18:28:52 EST 2003


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

Modified Files:
      Tag: Zope-2_7-branch
	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.22.16.1 => 1.22.16.2 ===
--- Zope/lib/python/zdaemon/zdoptions.py:1.22.16.1	Mon Sep 15 17:26:59 2003
+++ Zope/lib/python/zdaemon/zdoptions.py	Sun Dec 21 18:28:21 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 Zope-Checkins mailing list