Index: /pykota/trunk/pykota/storages/sql.py
===================================================================
--- /pykota/trunk/pykota/storages/sql.py (revision 2743)
+++ /pykota/trunk/pykota/storages/sql.py (revision 2749)
@@ -644,13 +644,42 @@
                        (self.doQuote(group.ident), self.doQuote(user.ident)))
             
-    def addUserPQuota(self, user, printer) :
+    def addUserPQuota(self, upq) :
         """Initializes a user print quota on a printer."""
-        self.doModify("INSERT INTO userpquota (userid, printerid) VALUES (%s, %s)" % (self.doQuote(user.ident), self.doQuote(printer.ident)))
-        return self.getUserPQuota(user, printer)
-        
-    def addGroupPQuota(self, group, printer) :
+        try :
+            self.doModify("INSERT INTO userpquota (userid, printerid, softlimit, hardlimit, warncount, datelimit, pagecounter, lifepagecounter, maxjobsize) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)" \
+                              % (self.doQuote(upq.User.ident), \
+                                 self.doQuote(upq.Printer.ident), \
+                                 self.doQuote(upq.SoftLimit), \
+                                 self.doQuote(upq.HardLimit), \
+                                 self.doQuote(upq.WarnCount), \
+                                 self.doQuote(upq.DateLimit), \
+                                 self.doQuote(upq.PageCounter), \
+                                 self.doQuote(upq.LifePageCounter), \
+                                 self.doQuote(upq.MaxJobSize)))
+        except PyKotaStorageError :                         
+            # TODO : check if this is an error different from a duplicate insert
+            # return the existing entry which has to be modified
+            return self.getUserPQuota(upq.User, upq.Printer)
+        else :    
+            upq.isDirty = False
+            return None # the entry created doesn't need further modification
+        
+    def addGroupPQuota(self, gpq) :
         """Initializes a group print quota on a printer."""
-        self.doModify("INSERT INTO grouppquota (groupid, printerid) VALUES (%s, %s)" % (self.doQuote(group.ident), self.doQuote(printer.ident)))
-        return self.getGroupPQuota(group, printer)
+        try :
+            self.doModify("INSERT INTO grouppquota (groupid, printerid, softlimit, hardlimit, datelimit, maxjobsize) VALUES (%s, %s, %s, %s, %s, %s)" \
+                              % (self.doQuote(gpq.Group.ident), \
+                                 self.doQuote(gpq.Printer.ident), \
+                                 self.doQuote(gpq.SoftLimit), \
+                                 self.doQuote(gpq.HardLimit), \
+                                 self.doQuote(gpq.DateLimit), \
+                                 self.doQuote(gpq.MaxJobSize)))
+        except PyKotaStorageError :                         
+            # TODO : check if this is an error different from a duplicate insert
+            # return the existing entry which has to be modified
+            return self.getGroupPQuota(gpq.Group, gpq.Printer)
+        else :    
+            gpq.isDirty = False
+            return None # the entry created doesn't need further modification
         
     def savePrinter(self, printer) :    
@@ -738,5 +767,5 @@
     def saveUserPQuota(self, userpquota) :
         """Saves an user print quota entry."""
-        self.doModify("UPDATE userpquota SET softlimit=%s, hardlimit=%s, warncount=%s, datelimit=%s, pagecounter=%s, lifepagecounter=%s WHERE id=%s" \
+        self.doModify("UPDATE userpquota SET softlimit=%s, hardlimit=%s, warncount=%s, datelimit=%s, pagecounter=%s, lifepagecounter=%s, maxjobsize=%s WHERE id=%s" \
                               % (self.doQuote(userpquota.SoftLimit), \
                                  self.doQuote(userpquota.HardLimit), \
@@ -745,4 +774,5 @@
                                  self.doQuote(userpquota.PageCounter), \
                                  self.doQuote(userpquota.LifePageCounter), \
+                                 self.doQuote(userpquota.MaxJobSize), \
                                  self.doQuote(userpquota.ident)))
         
@@ -843,4 +873,26 @@
             self.doModify(q)
             
+    def deleteManyUserPQuotas(self, printers, users) :        
+        """Deletes many user print quota entries."""
+        printerids = ", ".join(["%s" % self.doQuote(p.ident) for p in printers])
+        userids = ", ".join(["%s" % self.doQuote(u.ident) for u in users])
+        for q in [ 
+                    "DELETE FROM jobhistory WHERE userid IN (%s) AND printerid IN (%s)" \
+                                 % (userids, printerids),
+                    "DELETE FROM userpquota WHERE userid IN (%s) AND printerid IN (%s)" \
+                                 % (userids, printerids),
+                  ] :
+            self.doModify(q)
+            
+    def deleteManyGroupPQuotas(self, printers, groups) :
+        """Deletes many group print quota entries."""
+        printerids = ", ".join(["%s" % self.doQuote(p.ident) for p in printers])
+        groupids = ", ".join(["%s" % self.doQuote(g.ident) for g in groups])
+        for q in [ 
+                    "DELETE FROM grouppquota WHERE groupid IN (%s) AND printerid IN (%s)" \
+                                 % (groupids, printerids),
+                  ] :
+            self.doModify(q)
+        
     def deleteUserPQuota(self, upquota) :    
         """Completely deletes an user print quota entry from the database."""
Index: /pykota/trunk/pykota/storages/ldapstorage.py
===================================================================
--- /pykota/trunk/pykota/storages/ldapstorage.py (revision 2735)
+++ /pykota/trunk/pykota/storages/ldapstorage.py (revision 2749)
@@ -191,4 +191,6 @@
                 self.tool.logdebug("%s" % entry)
                 self.database.add_s(dn, entry)
+            except ldap.ALREADY_EXISTS, msg :        
+                raise PyKotaStorageError
             except ldap.LDAPError, msg :
                 message = (_("Problem adding LDAP entry (%s, %s)") % (dn, str(fields))) + " : %s" % str(msg)
@@ -454,5 +456,5 @@
             result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaUserName=%s)(pykotaPrinterName=%s))" % \
                                       (self.userCharsetToDatabase(user.Name), self.userCharsetToDatabase(printer.Name)), \
-                                      ["pykotaPageCounter", "pykotaLifePageCounter", "pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit", "pykotaWarnCount"], \
+                                      ["pykotaPageCounter", "pykotaLifePageCounter", "pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit", "pykotaWarnCount", "pykotaMaxJobSize"], \
                                       base=base)
             if result :
@@ -480,4 +482,10 @@
                     else :    
                         userpquota.DateLimit = userpquota.DateLimit[0]
+                userpquota.MaxJobSize = fields.get("pykotaMaxJobSize")
+                if userpquota.MaxJobSize is not None :
+                    if userpquota.MaxJobSize[0].upper() == "NONE" :
+                        userpquota.MaxJobSize = None
+                    else :    
+                        userpquota.MaxJobSize = int(userpquota.MaxJobSize[0])
                 userpquota.Exists = 1
         return userpquota
@@ -493,5 +501,5 @@
             result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaGroupName=%s)(pykotaPrinterName=%s))" % \
                                       (self.userCharsetToDatabase(group.Name), self.userCharsetToDatabase(printer.Name)), \
-                                      ["pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], \
+                                      ["pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit", "pykotaMaxJobSize"], \
                                       base=base)
             if result :
@@ -516,4 +524,10 @@
                     else :    
                         grouppquota.DateLimit = grouppquota.DateLimit[0]
+                grouppquota.MaxJobSize = fields.get("pykotaMaxJobSize")
+                if grouppquota.MaxJobSize is not None :
+                    if grouppquota.MaxJobSize[0].upper() == "NONE" :
+                        grouppquota.MaxJobSize = None
+                    else :    
+                        grouppquota.MaxJobSize = int(grouppquota.MaxJobSize[0])
                 grouppquota.PageCounter = 0
                 grouppquota.LifePageCounter = 0
@@ -1018,30 +1032,41 @@
         raise "Not Implemented !" # TODO !!!
                 
-    def addUserPQuota(self, user, printer) :
+    def addUserPQuota(self, upq) :
         """Initializes a user print quota on a printer."""
+        # first check if an entry already exists
+        oldentry = self.getUserPQuota(upq.User, upq.Printer)
+        if oldentry.Exists :
+            return oldentry # we return the existing entry
         uuid = self.genUUID()
-        uname = self.userCharsetToDatabase(user.Name)
-        pname = self.userCharsetToDatabase(printer.Name)
+        uname = self.userCharsetToDatabase(upq.User.Name)
+        pname = self.userCharsetToDatabase(upq.Printer.Name)
         fields = { "cn" : uuid,
                    "objectClass" : ["pykotaObject", "pykotaUserPQuota"],
                    "pykotaUserName" : uname,
                    "pykotaPrinterName" : pname,
-                   "pykotaDateLimit" : "None",
-                   "pykotaPageCounter" : "0",
-                   "pykotaLifePageCounter" : "0",
-                   "pykotaWarnCount" : "0",
+                   "pykotaSoftLimit" : str(upq.SoftLimit),
+                   "pykotaHardLimit" : str(upq.HardLimit),
+                   "pykotaDateLimit" : str(upq.DateLimit),
+                   "pykotaPageCounter" : str(upq.PageCounter or 0),
+                   "pykotaLifePageCounter" : str(upq.LifePageCounter or 0),
+                   "pykotaWarnCount" : str(upq.WarnCount or 0),
+                   "pykotaMaxJobSize" : str(upq.MaxJobSize or 0),
                  } 
         if self.info["userquotabase"].lower() == "user" :
-            dn = "cn=%s,%s" % (uuid, user.ident)
+            dn = "cn=%s,%s" % (uuid, upq.User.ident)
         else :    
             dn = "cn=%s,%s" % (uuid, self.info["userquotabase"])
         self.doAdd(dn, fields)
-        return self.getUserPQuota(user, printer)
-        
-    def addGroupPQuota(self, group, printer) :
+        upq.isDirty = False
+        return None # the entry created doesn't need further modification
+        
+    def addGroupPQuota(self, gpq) :
         """Initializes a group print quota on a printer."""
+        oldentry = self.getGroupPQuota(gpq.Group, gpq.Printer)
+        if oldentry.Exists :
+            return oldentry # we return the existing entry
         uuid = self.genUUID()
-        gname = self.userCharsetToDatabase(group.Name)
-        pname = self.userCharsetToDatabase(printer.Name)
+        gname = self.userCharsetToDatabase(gpq.Group.Name)
+        pname = self.userCharsetToDatabase(gpq.Printer.Name)
         fields = { "cn" : uuid,
                    "objectClass" : ["pykotaObject", "pykotaGroupPQuota"],
@@ -1051,9 +1076,10 @@
                  } 
         if self.info["groupquotabase"].lower() == "group" :
-            dn = "cn=%s,%s" % (uuid, group.ident)
+            dn = "cn=%s,%s" % (uuid, gpq.Group.ident)
         else :    
             dn = "cn=%s,%s" % (uuid, self.info["groupquotabase"])
         self.doAdd(dn, fields)
-        return self.getGroupPQuota(group, printer)
+        gpq.isDirty = False
+        return None # the entry created doesn't need further modification
         
     def savePrinter(self, printer) :    
@@ -1204,7 +1230,8 @@
                    "pykotaHardLimit" : str(userpquota.HardLimit),
                    "pykotaDateLimit" : str(userpquota.DateLimit),
-                   "pykotaWarnCount" : str(userpquota.WarnCount),
-                   "pykotaPageCounter" : str(userpquota.PageCounter),
-                   "pykotaLifePageCounter" : str(userpquota.LifePageCounter),
+                   "pykotaWarnCount" : str(userpquota.WarnCount or 0),
+                   "pykotaPageCounter" : str(userpquota.PageCounter or 0),
+                   "pykotaLifePageCounter" : str(userpquota.LifePageCounter or 0),
+                   "pykotaMaxJobSize" : str(userpquota.MaxJobSize or 0),
                  }
         self.doModify(userpquota.ident, fields)
@@ -1230,4 +1257,5 @@
                    "pykotaHardLimit" : str(grouppquota.HardLimit),
                    "pykotaDateLimit" : str(grouppquota.DateLimit),
+                   "pykotaMaxJobSize" : str(userpquota.MaxJobSize or 0),
                  }
         self.doModify(grouppquota.ident, fields)
@@ -1427,4 +1455,22 @@
                 self.doDelete(group.ident)
                 
+    def deleteManyUserPQuotas(self, printers, users) :        
+        """Deletes many user print quota entries."""
+        # TODO : grab all with a single (possibly VERY huge) filter if possible (might depend on the LDAP server !)
+        for printer in printers :
+            for user in users :
+                upq = self.getUserPQuota(user, printer)
+                if upq.Exists :
+                    upq.delete()
+            
+    def deleteManyGroupPQuotas(self, printers, groups) :
+        """Deletes many group print quota entries."""
+        # TODO : grab all with a single (possibly VERY huge) filter if possible (might depend on the LDAP server !)
+        for printer in printers :
+            for group in groups :
+                gpq = self.getGroupPQuota(group, printer)
+                if gpq.Exists :
+                    gpq.delete()
+                
     def deleteUserPQuota(self, upquota) :    
         """Completely deletes an user print quota entry from the database."""
Index: /pykota/trunk/bin/edpykota
===================================================================
--- /pykota/trunk/bin/edpykota (revision 2743)
+++ /pykota/trunk/bin/edpykota (revision 2749)
@@ -32,5 +32,5 @@
 from pykota.tool import PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_
 from pykota.config import PyKotaConfigError
-from pykota.storage import PyKotaStorageError
+from pykota.storage import PyKotaStorageError, StorageUserPQuota, StorageGroupPQuota
 
 __doc__ = N_("""edpykota v%(__version__)s (c) %(__years__)s %(__author__)s
@@ -163,138 +163,90 @@
             names = ["*"]
             
-        before = time.time()
-        (printers, entries, pqentries) = getattr(self.storage, "getPrinters%ssAndPQuotas" % suffix)(printernames, names)
-        after = time.time()
-        self.printInfo("Data extraction took : %.4f seconds" % (after - before))
+        if not options["list"] :
+            self.display(_("Extracting datas..."))
+        printers = self.storage.getMatchingPrinters(options["printer"])
+        entries = getattr(self.storage, "getMatching%ss" % suffix)(",".join(names))
         
         if options["delete"] :    
-            self.display("%s...\n" % _("Deletion"))
-            nbtotal = len(pqentries)
-            for i in range(nbtotal) :
-                (pqkey, pqentry) = pqentries.popitem()
-                if pqentry.Exists :
-                    pqentry.delete()
-                percent = 100.0 * float(i) / float(nbtotal)
-                self.display("\r%.02f%%" % percent)
+            self.display("\n%s..." % _("Deletion"))
+            getattr(self.storage, "deleteMany%sPQuotas" % suffix)(printers, entries)
+            self.display("\n")
+            self.display("\r100.00%%\r        \r%s\n" % _("Done."))
         else :
             skipexisting = options["skipexisting"]
+            used = options["used"]
+            if used :
+                used = used.strip()
+                try :
+                    int(used)
+                except ValueError :
+                    raise PyKotaCommandLineError, _("Invalid used value %s.") % used
+                    
+            increase = options["increase"]
+            if increase :
+                try :
+                    increase = int(increase.strip())
+                except ValueError :
+                    raise PyKotaCommandLineError, _("Invalid increase value %s.") % increase
+            
+            softlimit = hardlimit = None
+            noquota = options["noquota"]
+            if not noquota :
+                if options["softlimit"] :
+                    try :
+                        softlimit = int(options["softlimit"].strip())
+                        if softlimit < 0 :
+                            raise ValueError
+                    except ValueError :    
+                        raise PyKotaCommandLineError, _("Invalid softlimit value %s.") % options["softlimit"]
+                if options["hardlimit"] :
+                    try :
+                        hardlimit = int(options["hardlimit"].strip())
+                        if hardlimit < 0 :
+                            raise ValueError
+                    except ValueError :    
+                        raise PyKotaCommandLineError, _("Invalid hardlimit value %s.") % options["hardlimit"]
+                if (softlimit is not None) and (hardlimit is not None) and (hardlimit < softlimit) :        
+                    # error, exchange them
+                    self.printInfo(_("Hard limit %i is less than soft limit %i, values will be exchanged.") % (hardlimit, softlimit))
+                    (softlimit, hardlimit) = (hardlimit, softlimit)
+                if hardlimit is None :    
+                    hardlimit = softlimit
+                    if hardlimit is not None :
+                        self.printInfo(_("Undefined hard limit set to soft limit (%s).") % str(hardlimit))
+                if softlimit is None :    
+                    softlimit = hardlimit
+                    if softlimit is not None :
+                        self.printInfo(_("Undefined soft limit set to hard limit (%s).") % str(softlimit))
+                        
+            pqentries = []            
             if options["add"] :
-                self.display("%s...\n" % _("Creation"))
-                mentries = getattr(self.storage, "getMatching%ss" % suffix)(",".join(names))
+                self.display("\n%s...\n" % _("Creation"))
                 dicnames = {}
-                for m in mentries :
+                for m in entries :
                     dicnames[m.Name] = None
                 for name in names :
                     if not dicnames.has_key(name) :
-                        self.printInfo(_("Impossible to create print quota entries if the user or group object %s doesn't already exist. Please use pkusers to create it first.") % name, "warn")
-                mprinters = self.storage.getMatchingPrinters(options["printer"])
-                nbtotal = len(mprinters) * len(mentries)
+                        self.printInfo(_("Impossible to create print quota entries if the user or group object '%s' doesn't already exist. Please use pkusers to create it first.") % name, "warn")
+                        
+                factory = globals()["Storage%sPQuota" % suffix]
+                nbtotal = len(printers) * len(entries)
                 i = 0
-                for printer in mprinters :
+                for printer in printers :
                     pname = printer.Name
-                    for entry in mentries :
+                    for entry in entries :
                         ename = entry.Name
                         pqkey = "%s@%s" % (ename, pname)
-                        if pqentries.has_key(pqkey) and pqentries[pqkey].Exists :
-                            if skipexisting :
-                                self.printInfo(_("%s print quota entry %s@%s already exists, skipping.") % (suffix, ename, pname))
-                                del pqentries[pqkey]
-                            else :    
-                                self.printInfo(_("%s print quota entry %s@%s already exists, will be modified.") % (suffix, ename, pname))
-                        else :        
-                            newpqentry = getattr(self.storage, "add%sPQuota" % suffix)(entry, printer)
-                            if not newpqentry.Exists :
-                                self.printInfo(_("Impossible to create a print quota entry for %s@%s") % (ename, pname))
-                            else :
-                                pqentries[pqkey] = newpqentry
-                        i += 1
-                        percent = 100.0 * float(i) / float(nbtotal)
-                        self.display("\r%.02f%%" % percent)
-                self.display("\r100.00%%\r        \r%s\n" % _("Done."))
-                
-            if not pqentries :
-                raise PyKotaCommandLineError, _("There's no %s print quota entry matching %s") % (suffix.lower(), " ".join(names))
-                    
-            if options["list"] :
-                for (name, entry) in pqentries.items() :
-                    if entry.Exists :
-                        print name
-                        print "    %s" % (_("Page counter : %s") % entry.PageCounter)
-                        print "    %s" % (_("Lifetime page counter : %s") % entry.LifePageCounter)
-                        print "    %s" % (_("Soft limit : %s") % entry.SoftLimit)
-                        print "    %s" % (_("Hard limit : %s") % entry.HardLimit)
-                        print "    %s" % (_("Date limit : %s") % entry.DateLimit)
-                        # TODO : print "    %s" % (_("Maximum job size : %s") % ((entry.MaxJobSize and (_("%s pages") % entry.MaxJobSize)) or _("Unlimited")))
-                        if hasattr(entry, "WarnCount") :
-                            print "    %s" % (_("Warning banners printed : %s") % entry.WarnCount)
-                        print
-            else :
-                self.display("%s...\n" % _("Modification"))
-                
-                used = options["used"]
-                if used :
-                    used = used.strip()
-                    try :
-                        int(used)
-                    except ValueError :
-                        raise PyKotaCommandLineError, _("Invalid used value %s.") % used
-                        
-                increase = options["increase"]
-                if increase :
-                    try :
-                        increase = int(increase.strip())
-                    except ValueError :
-                        raise PyKotaCommandLineError, _("Invalid increase value %s.") % increase
-                
-                softlimit = hardlimit = None
-                noquota = options["noquota"]
-                if not noquota :
-                    if options["softlimit"] :
-                        try :
-                            softlimit = int(options["softlimit"].strip())
-                            if softlimit < 0 :
-                                raise ValueError
-                        except ValueError :    
-                            raise PyKotaCommandLineError, _("Invalid softlimit value %s.") % options["softlimit"]
-                    if options["hardlimit"] :
-                        try :
-                            hardlimit = int(options["hardlimit"].strip())
-                            if hardlimit < 0 :
-                                raise ValueError
-                        except ValueError :    
-                            raise PyKotaCommandLineError, _("Invalid hardlimit value %s.") % options["hardlimit"]
-                    if (softlimit is not None) and (hardlimit is not None) and (hardlimit < softlimit) :        
-                        # error, exchange them
-                        self.printInfo(_("Hard limit %i is less than soft limit %i, values will be exchanged.") % (hardlimit, softlimit))
-                        (softlimit, hardlimit) = (hardlimit, softlimit)
-                    if hardlimit is None :    
-                        hardlimit = softlimit
-                        if hardlimit is not None :
-                            self.printInfo(_("Undefined hard limit set to soft limit (%s) on printer %s.") % (str(hardlimit), printer.Name))
-                    if softlimit is None :    
-                        softlimit = hardlimit
-                        if softlimit is not None :
-                            self.printInfo(_("Undefined soft limit set to hard limit (%s) on printer %s.") % (str(softlimit), printer.Name))
-                    
-                nbtotal = len(pqentries)    
-                i = 0
-                for (pqkey, pqentry) in pqentries.items() :
-                    ename = getattr(pqentry, suffix).Name
-                    pname = pqentry.Printer.Name
-                    if pqentry.Exists :     
+                        pqentry = factory(self.storage, entry, printer)
                         if noquota or ((softlimit is not None) and (hardlimit is not None)) :
                             pqentry.setLimits(softlimit, hardlimit)
                             
                         if increase :
-                           if (pqentry.SoftLimit is None) \
-                               or (pqentry.HardLimit is None) :
-                               self.printInfo(_("You can't increase limits by %s when no limit is set.") % increase, "error")
-                           else :
-                               newsoft = pqentry.SoftLimit + increase         
-                               newhard = pqentry.HardLimit + increase         
-                               if (newsoft >= 0) and (newhard >= 0) :
-                                   pqentry.setLimits(newsoft, newhard)
-                               else :    
-                                   self.printInfo(_("You can't set negative limits."), "error")
+                            newsoft = (pqentry.SoftLimit or 0) + increase         
+                            newhard = (pqentry.HardLimit or 0) + increase         
+                            if (newsoft >= 0) and (newhard >= 0) :
+                                pqentry.setLimits(newsoft, newhard)
+                            else :    
+                                self.printInfo(_("You can't set negative limits."), "error")
                         
                         if options["reset"] :
@@ -307,12 +259,72 @@
                             if used :
                                 pqentry.setUsage(used)
+                        
+                        oldpqentry = getattr(self.storage, "add%sPQuota" % suffix)(pqentry)
+                        if oldpqentry is not None :    
+                            if skipexisting :
+                                self.printInfo(_("%s print quota entry %s@%s already exists, skipping.") % (suffix, ename, pname))
+                            else :    
+                                self.printInfo(_("%s print quota entry %s@%s already exists, will be modified.") % (suffix, ename, pname))
+                                pqentries.append(oldpqentry)
+                        i += 1
+                        percent = 100.0 * float(i) / float(nbtotal)
+                        self.display("\r%.02f%%" % percent)
+                self.display("\r100.00%%\r        \r%s" % _("Done."))
+            else :    
+                for printer in printers :
+                    for entry in entries :
+                        pqentries.append(getattr(self.storage, "get%sPQuota" % suffix)(entry, printer))
+                if not pqentries :        
+                    raise PyKotaCommandLineError, _("There's no %s print quota entry matching %s") % (suffix.lower(), " ".join(names))
+                    
+            if options["list"] :
+                for pqentry in pqentries :
+                    if pqentry.Exists :
+                        print "%s@%s" % (getattr(pqentry, suffix).Name, pqentry.Printer.Name)
+                        print "    %s" % (_("Page counter : %s") % pqentry.PageCounter)
+                        print "    %s" % (_("Lifetime page counter : %s") % pqentry.LifePageCounter)
+                        print "    %s" % (_("Soft limit : %s") % pqentry.SoftLimit)
+                        print "    %s" % (_("Hard limit : %s") % pqentry.HardLimit)
+                        print "    %s" % (_("Date limit : %s") % pqentry.DateLimit)
+                        print "    %s (Not supported yet)" % (_("Maximum job size : %s") % ((pqentry.MaxJobSize and (_("%s pages") % pqentry.MaxJobSize)) or _("Unlimited")))
+                        if hasattr(pqentry, "WarnCount") :
+                            print "    %s" % (_("Warning banners printed : %s") % pqentry.WarnCount)
+                        print
+            else :
+                self.display("\n")
+                nbtotal = len(pqentries)    
+                if nbtotal :
+                    self.display("%s...\n" % _("Modification"))
+                    i = 0
+                    for pqentry in pqentries :
+                        ename = getattr(pqentry, suffix).Name
+                        pname = pqentry.Printer.Name
+                        if pqentry.Exists :     
+                            if noquota or ((softlimit is not None) and (hardlimit is not None)) :
+                                pqentry.setLimits(softlimit, hardlimit)
                                 
-                        pqentry.save()        
-                    i += 1            
-                    percent = 100.0 * float(i) / float(nbtotal)
-                    self.display("\r%.02f%%" % percent)
+                            if increase :
+                                newsoft = (pqentry.SoftLimit or 0) + increase         
+                                newhard = (pqentry.HardLimit or 0) + increase         
+                                if (newsoft >= 0) and (newhard >= 0) :
+                                    pqentry.setLimits(newsoft, newhard)
+                                else :    
+                                    self.printInfo(_("You can't set negative limits for %s@%s") % (ename, pname), "error")
+                            
+                            if options["reset"] :
+                                pqentry.reset()
                                 
-        if not options["list"] :                
-            self.display("\r100.00%%\r        \r%s\n" % _("Done."))
+                            if options["hardreset"] :    
+                                pqentry.hardreset()
+                                
+                            if not options["groups"] :
+                                if used :
+                                    pqentry.setUsage(used)
+                                    
+                            pqentry.save()        
+                        i += 1            
+                        percent = 100.0 * float(i) / float(nbtotal)
+                        self.display("\r%.02f%%" % percent)
+                    self.display("\r100.00%%\r        \r%s\n" % _("Done."))
                      
 if __name__ == "__main__" : 
