Index: pykota/trunk/bin/pkprinters
===================================================================
--- pykota/trunk/bin/pkprinters (revision 1546)
+++ pykota/trunk/bin/pkprinters (revision 1582)
@@ -24,4 +24,7 @@
 #
 # $Log$
+# Revision 1.12  2004/07/01 17:45:47  jalet
+# Added code to handle the description field for printers
+#
 # Revision 1.11  2004/06/18 13:34:48  jalet
 # Now all tracebacks include PyKota's version number
@@ -87,4 +90,6 @@
                        
   -d | --delete        Deletes printers from the quota storage.
+  
+  -D | --description   Adds a textual description to printers.
                        
   -c | --charge p[,j]  Sets the price per page and per job to charge.
@@ -122,5 +127,5 @@
 examples :                              
 
-  $ pkprinters --add --charge 0.05,0.1 hp2100 hp2200 hp8000
+  $ pkprinters --add -D "HP Printer" --charge 0.05,0.1 hp2100 hp2200 hp8000
   
   Will create three printers named hp2100, hp2200 and hp8000.
@@ -128,6 +133,7 @@
   per job will be set at 0.1 unit. Units are in your own currency,
   or whatever you want them to mean.
-  If any of these printers already exists, it is not modified at
-  all.
+  All of their descriptions will be set to the string "HP Printer".
+  If any of these printers already exists, it will also be modified 
+  unless the -s|--skipexisting command line option is also used.
             
   $ pkprinters --delete "*"
@@ -191,7 +197,7 @@
                 if printer.Exists :
                     if options["skipexisting"] :
-                        self.logger.log_message(_("Printer %s already exists, skipping.") % printer.Name, "warn")
+                        self.printError(_("Printer %s already exists, skipping.") % printer.Name)
                     else :    
-                        self.logger.log_message(_("Printer %s already exists, will be modified.") % printer.Name, "warn")
+                        self.printError(_("Printer %s already exists, will be modified.") % printer.Name)
                         printers.append(printer)
                 else :
@@ -216,10 +222,12 @@
                 if parents : 
                     parents = "%s %s" % (_("in"), parents)
-                print "%s (%s + #*%s) %s" % \
-                      (printer.Name, printer.PricePerJob, \
+                print "%s [%s] (%s + #*%s) %s" % \
+                      (printer.Name, printer.Description, printer.PricePerJob, \
                        printer.PricePerPage, parents)
             else :    
                 if options["charge"] :
                     printer.setPrices(perpage, perjob)    
+                if options["description"] is not None :
+                    printer.setDescription(options["description"].strip())
                 if options["groups"] :    
                     for pgroup in printersgroups :
@@ -232,6 +240,6 @@
     retcode = 0
     try :
-        short_options = "hvac:dg:lrs"
-        long_options = ["help", "version", "add", "charge=", "delete", "groups=", "list", "remove", "skipexisting"]
+        short_options = "hvac:D:dg:lrs"
+        long_options = ["help", "version", "add", "charge=", "description=", "delete", "groups=", "list", "remove", "skipexisting"]
         
         # Initializes the command line tool
@@ -246,4 +254,5 @@
         options["add"] = options["a"] or options["add"]
         options["charge"] = options["c"] or options["charge"]
+        options["description"] = options["D"] or options["description"]
         options["delete"] = options["d"] or options["delete"] 
         options["groups"] = options["g"] or options["groups"]
@@ -256,7 +265,7 @@
         elif options["version"] :
             manager.display_version_and_quit()
-        elif (options["delete"] and (options["add"] or options["groups"] or options["charge"] or options["remove"])) \
+        elif (options["delete"] and (options["add"] or options["groups"] or options["charge"] or options["remove"] or options["description"])) \
            or (options["skipexisting"] and not options["add"]) \
-           or (options["list"] and (options["add"] or options["delete"] or options["groups"] or options["charge"] or options["remove"])) :
+           or (options["list"] and (options["add"] or options["delete"] or options["groups"] or options["charge"] or options["remove"] or options["description"])) :
             raise PyKotaToolError, _("incompatible options, see help.")
         elif options["remove"] and not options["groups"] :    
