[Pkg-zope-developers] patch to help first-time users use dzhandle

nchauvat at nerim.net nchauvat at nerim.net
Sat Feb 18 15:36:21 UTC 2006


Please find attached a patched that will help first-time users:

dzhandle make-instance (instance name missing)

will now provide a better error message

dzhandle list-products (no zope version given)

will provide a better explanation of what it does

hope this helps.

--
Nicolas
-------------- next part --------------
--- dzhandle.orig	2006-02-18 14:56:23.000000000 +0100
+++ /usr/sbin/dzhandle	2006-02-18 15:47:37.000000000 +0100
@@ -4,6 +4,7 @@
 import pwd, grp
 import logging
 from optparse import OptionParser
+from sets import Set
 
 program = os.path.basename(sys.argv[0])
 
@@ -1117,10 +1118,13 @@
 
     def run(self, global_options):
         if self.instance:
+            print 'Listing products installed for instance', self.instance.name
             addons = self.instance.installed_addons()
         else:
+            if len(global_options.zversion) > 1:
+	        print 'Listing products available for all version(s):',	' '.join(global_options.zversion)
             addons = locate_addons(self.addonClass, zopeversions=global_options.zversion)
 
 class DZListProducts(ProductAttributes, DZListAddons):
@@ -1313,6 +1317,11 @@
     name = 'make-instance'
     help = 'run zope version mkzopeinstance'
 
+    def __init__(self):
+        DZAction.__init__(self)
+        self.get_option_parser().set_usage(
+            'usage: %s [<option> ...] %s <instance-name> [<option> ...]' % (program, self.name))
+
     def get_option_parser(self):
         if not self._option_parser:
             p = OptionParser()
@@ -1878,10 +1887,9 @@
                     addonClass = Extension
             addon = addonClass(path, False)
             if zopeversions != None:
-                zver = True
-                for z in zopeversions:
-                    zver = zver and (z in addon.zopeversions.split(" "))
-            else: zver = True
+                zver = Set(zopeversions) <= Set(addon.zopeversions.split())
+            else: 
+	        zver = True
             if zver:
                 addons.append(addon)
     return addons


More information about the Pkg-zope-developers mailing list