Index: /pykota/trunk/bin/warnpykota
===================================================================
--- /pykota/trunk/bin/warnpykota (revision 873)
+++ /pykota/trunk/bin/warnpykota (revision 890)
@@ -23,4 +23,7 @@
 #
 # $Log$
+# Revision 1.12  2003/04/08 21:10:18  jalet
+# Checks --groups option presence instead of --users because --users is the default.
+#
 # Revision 1.11  2003/03/29 13:45:27  jalet
 # GPL paragraphs were incorrectly (from memory) copied into the sources.
@@ -129,10 +132,10 @@
             raise PyKotaToolError, _("There's no printer matching %s") % options["printer"]
         for (printer, printerpagecounter) in printernames :
-            if options["users"] :
+            if options["groups"] :
+                for name in self.storage.getPrinterGroups(printer) :
+                    self.warnGroupPQuota(name, printer)
+            else :
                 for name in self.storage.getPrinterUsers(printer) :
                     self.warnUserPQuota(name, printer)
-            else :
-                for name in self.storage.getPrinterGroups(printer) :
-                    self.warnGroupPQuota(name, printer)
                      
 if __name__ == "__main__" : 
Index: /pykota/trunk/bin/edpykota
===================================================================
--- /pykota/trunk/bin/edpykota (revision 886)
+++ /pykota/trunk/bin/edpykota (revision 890)
@@ -23,4 +23,7 @@
 #
 # $Log$
+# Revision 1.30  2003/04/08 21:10:18  jalet
+# Checks --groups option presence instead of --users because --users is the default.
+#
 # Revision 1.29  2003/04/05 09:28:56  jalet
 # Unnecessary message was logged
@@ -256,8 +259,9 @@
         for (printer, printerpagecounter) in printernames :
             if options["prototype"] :
-                if options["users"] :
+                if options["groups"] :
+                    prototype = self.storage.getGroupPQuota(options["prototype"], printer)
+                else :     
+                    # default is user quota edition
                     prototype = self.storage.getUserPQuota(options["prototype"], printer)
-                else :     
-                    prototype = self.storage.getGroupPQuota(options["prototype"], printer)
                 if prototype is None :
                     self.logger.log_message(_("Prototype %s not found in Quota Storage for printer %s.") % (options["prototype"], printer))
@@ -278,13 +282,13 @@
                 allnames = names
             else :   
-                if options["users"] :    
+                if options["groups"] :    
+                    allnames = self.storage.getPrinterGroups(printer)
+                else :    
                     allnames = self.storage.getPrinterUsers(printer)
-                else :    
-                    allnames = self.storage.getPrinterGroups(printer)
             for name in [n for n in allnames if self.matchString(n, names)]:
-                if options["users"] :
+                if options["groups"] :
+                    quota = self.storage.getGroupPQuota(name, printer)
+                else :
                     quota = self.storage.getUserPQuota(name, printer)
-                else :
-                    quota = self.storage.getGroupPQuota(name, printer)
                 if quota is None :
                     # not found
@@ -294,5 +298,11 @@
                         # like /etc/passwd because users may be defined 
                         # only remotely
-                        if options["users"] :
+                        if options["groups"] :
+                            if self.isValidName(name) :
+                                self.storage.addGroupPQuota(name, printer)
+                                quota = self.storage.getGroupPQuota(name, printer)
+                            else :    
+                                self.logger.log_message(_("Invalid group name %s") % name)
+                        else :
                             if self.isValidName(name) :
                                 self.storage.addUserPQuota(name, printer)
@@ -300,23 +310,17 @@
                             else :    
                                 self.logger.log_message(_("Invalid user name %s") % name)
-                        else :
-                            if self.isValidName(name) :
-                                self.storage.addGroupPQuota(name, printer)
-                                quota = self.storage.getGroupPQuota(name, printer)
-                            else :    
-                                self.logger.log_message(_("Invalid group name %s") % name)
                 if quota is None :     
                     self.logger.log_message(_("Quota not found for object %s on printer %s.") % (name, printer))
                 else :    
-                    if options["users"] :
+                    if options["groups"] :
+                        if options["noquota"] or ((softlimit is not None) and (hardlimit is not None)) :
+                            self.storage.setGroupPQuota(name, printer, softlimit, hardlimit)
+                        if options["reset"] :
+                            self.storage.resetGroupPQuota(name, printer)
+                    else :
                         if options["noquota"] or ((softlimit is not None) and (hardlimit is not None)) :
                             self.storage.setUserPQuota(name, printer, softlimit, hardlimit)
                         if options["reset"] :
                             self.storage.resetUserPQuota(name, printer)
-                    else :
-                        if options["noquota"] or ((softlimit is not None) and (hardlimit is not None)) :
-                            self.storage.setGroupPQuota(name, printer, softlimit, hardlimit)
-                        if options["reset"] :
-                            self.storage.resetGroupPQuota(name, printer)
                      
 if __name__ == "__main__" : 
Index: /pykota/trunk/bin/repykota
===================================================================
--- /pykota/trunk/bin/repykota (revision 873)
+++ /pykota/trunk/bin/repykota (revision 890)
@@ -23,4 +23,7 @@
 #
 # $Log$
+# Revision 1.18  2003/04/08 21:10:18  jalet
+# Checks --groups option presence instead of --users because --users is the default.
+#
 # Revision 1.17  2003/03/29 13:45:27  jalet
 # GPL paragraphs were incorrectly (from memory) copied into the sources.
@@ -147,15 +150,16 @@
             print _("Pages grace time: %idays") % self.config.getGraceDelay(printer)
             total = 0
-            if options["users"] :
+            if options["groups"] :
+                print _("Group            used     soft     hard   grace        total")
+                print "------------------------------------------------------------"
+                for name in self.storage.getPrinterGroups(printer) :
+                    quota = self.storage.getGroupPQuota(name, printer) 
+                    total += self.printQuota(name, quota)
+            else :
+                # default is user quota report
                 print _("User             used     soft     hard   grace        total")
                 print "------------------------------------------------------------"
                 for name in self.storage.getPrinterUsers(printer) :
                     quota = self.storage.getUserPQuota(name, printer)
-                    total += self.printQuota(name, quota)
-            else :
-                print _("Group            used     soft     hard   grace        total")
-                print "------------------------------------------------------------"
-                for name in self.storage.getPrinterGroups(printer) :
-                    quota = self.storage.getGroupPQuota(name, printer) 
                     total += self.printQuota(name, quota)
             if total :        
