Index: pykota/trunk/bin/dumpykota
===================================================================
--- pykota/trunk/bin/dumpykota (revision 1990)
+++ pykota/trunk/bin/dumpykota (revision 1991)
@@ -24,4 +24,8 @@
 #
 # $Log$
+# Revision 1.17  2004/12/21 15:50:00  jalet
+# The dumpykota command now supports extended filtering capabilities with
+# the PostgreSQL backend. LDAP doesn't yet support such possibilities.
+#
 # Revision 1.16  2004/12/21 14:45:31  jalet
 # Prepared dumpykota to accept the new --filter command line option. Some
@@ -106,5 +110,5 @@
 command line usage :
 
-  dumpykota [options] 
+  dumpykota [options] [filterexpr]
 
 options :
@@ -138,27 +142,26 @@
                          - xml : dump data as XML
                          
-  -F - | --filter exp  Uses the filter to extract only parts of the                          
-                       datas. Allowed filters are of the form :
-                       
-                         key=value
-                         
-                       Allowed keys for now are :  
-                       
-                         username       User's name
-                         groupname      Users group's name
-                         printername    Printer's name
-                         pgroupname     Printers group's name
-                         
-                       Contrary to other PyKota management tools, wildcard
-                       characters are not expanded, so you can't use them.
-                         
-                       NB : not all keys are allowed for each data type,
-                       so the result may be empty if you use a key not
-                       available for a particular data type.
-                         
   -o | --output fname  All datas will be dumped to the file instead of
                        to the standard output. The special '-' filename
                        is the default value and means stdout.
                        WARNING : existing files are truncated !
+                       
+  Use the filter expressions to extract only parts of the 
+  datas. Allowed filters are of the form :
+                
+         key=value
+                         
+  Allowed keys for now are :  
+                       
+         username       User's name
+         groupname      Users group's name
+         printername    Printer's name
+         pgroupname     Printers group's name
+         
+  Contrary to other PyKota management tools, wildcard characters are not 
+  expanded, so you can't use them.
+  
+  NB : not all keys are allowed for each data type, so the result may be 
+  empty if you use a key not available for a particular data type.
   
 Examples :
@@ -173,7 +176,7 @@
   Dumps all users datas to the users.xml file.
   
-  $ dumpykota --data history --filter printername=HP2100
-  
-  Dumps the job history for printer HP2100 only.
+  $ dumpykota --data history printername=HP2100 username=jerome
+  
+  Dumps the job history for user jerome on printer HP2100 only.
   
 This program is free software; you can redistribute it and/or modify
@@ -201,18 +204,18 @@
             
         extractonly = {}
-        filterexp = options["filter"]    
-        if filterexp :
-            try :
-                (filterkey, filtervalue) = [part.strip() for part in filterexp.split("=")]
-                if filterkey not in [ "username",
-                                      "groupname",
-                                      "printername",
-                                      "pgroupname",
-                                    ] :
-                    raise ValueError                
-            except ValueError :    
-                raise PyKotaToolError, _("Invalid value [%s] for --filter command line option, see help.") % filterexp
-            else :    
-                extractonly = { filterkey : filtervalue }
+        for filterexp in arguments :
+            if filterexp.strip() :
+                try :
+                    (filterkey, filtervalue) = [part.strip() for part in filterexp.split("=")]
+                    if filterkey not in [ "username",
+                                          "groupname",
+                                          "printername",
+                                          "pgroupname",
+                                        ] :
+                        raise ValueError                
+                except ValueError :    
+                    raise PyKotaToolError, _("Invalid value [%s] for --filter command line option, see help.") % filterexp
+                else :    
+                    extractonly.update({ filterkey : filtervalue })
             
         datatype = options["data"]
@@ -306,6 +309,6 @@
                      "output" : "-", \
                    }
-        short_options = "vhd:f:o:F:"
-        long_options = ["help", "version", "data=", "format=", "output=", "filter="]
+        short_options = "vhd:f:o:"
+        long_options = ["help", "version", "data=", "format=", "output="]
         
         # Initializes the command line tool
@@ -321,5 +324,4 @@
         options["format"] = options["f"] or options["format"] or defaults["format"]
         options["output"] = options["o"] or options["output"] or defaults["output"]
-        options["filter"] = options["F"] or options["filter"]
         
         if options["help"] :
@@ -330,6 +332,4 @@
             raise PyKotaToolError, _("The -d | --data command line option is mandatory, see help.")
         else :
-            if args :
-                raise PyKotaToolError, _("Too many arguments, see help.")
             retcode = dumper.main(args, options)
     except SystemExit :        
