Index: pykota/trunk/bin/edpykota
===================================================================
--- pykota/trunk/bin/edpykota (revision 2772)
+++ pykota/trunk/bin/edpykota (revision 2782)
@@ -28,5 +28,5 @@
 import os
 
-from pykota.tool import PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_
+from pykota.tool import Percent, PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_
 from pykota.config import PyKotaConfigError
 from pykota.storage import PyKotaStorageError, StorageUserPQuota, StorageGroupPQuota
@@ -197,9 +197,8 @@
                         print
         elif options["delete"] :    
-            self.display("\n%s..." % _("Deletion"))
+            percent = Percent(self, "\n%s..." % _("Deletion"), len(printers) * len(entries))
             getattr(self.storage, "deleteMany%sPQuotas" % suffix)(printers, entries)
-            self.display("\n")
+            percent.display("\n")
         else :
-            self.display("\n")    
             skipexisting = options["skipexisting"]
             used = options["used"]
@@ -253,5 +252,5 @@
             try :
                 if options["add"] :
-                    self.display("%s...\n" % _("Creation"))
+                    percent = Percent(self, "\n%s...\n" % _("Creation"), len(printers) * len(entries))
                     dicnames = {}
                     for m in entries :
@@ -262,6 +261,4 @@
                             
                     factory = globals()["Storage%sPQuota" % suffix]
-                    nbtotal = len(printers) * len(entries)
-                    i = 0
                     for printer in printers :
                         pname = printer.Name
@@ -285,25 +282,18 @@
                                                         hardreset, suffix, used)
                                     oldpqentry.save()                    
-                            i += 1
-                            percent = 100.0 * float(i) / float(nbtotal)
-                            self.display("\r%.02f%%" % percent)
+                            percent.oneMore()
                 else :        
-                    nbtotal = len(entries) * len(printers)
-                    if nbtotal :
-                        self.display("%s...\n" % _("Modification"))
-                        i = 0
-                        for printer in printers :
-                            for entry in entries :
-                                pqkey = "%s@%s" % (entry.Name, printer.Name)
-                                pqentry = getattr(self.storage, "get%sPQuota" % suffix)(entry, printer)
-                                if pqentry.Exists :     
-                                    self.modifyPQEntry(pqkey, pqentry, noquota, \
-                                                        softlimit, hardlimit, \
-                                                        increase, reset, \
-                                                        hardreset, suffix, used)
-                                    pqentry.save()        
-                                i += 1            
-                                percent = 100.0 * float(i) / float(nbtotal)
-                                self.display("\r%.02f%%" % percent)
+                    percent = Percent(self, "\n%s...\n" % _("Modification"), len(entries) * len(printers))
+                    for printer in printers :
+                        for entry in entries :
+                            pqkey = "%s@%s" % (entry.Name, printer.Name)
+                            pqentry = getattr(self.storage, "get%sPQuota" % suffix)(entry, printer)
+                            if pqentry.Exists :     
+                                self.modifyPQEntry(pqkey, pqentry, noquota, \
+                                                    softlimit, hardlimit, \
+                                                    increase, reset, \
+                                                    hardreset, suffix, used)
+                                pqentry.save()        
+                            percent.oneMore()
             except :                    
                 self.storage.rollbackTransaction()
@@ -312,6 +302,8 @@
                 self.storage.commitTransaction()
                             
-        if not options["list"] :
-            self.done()         
+        try :
+            percent.done()
+        except NameError :    
+            pass
             
 if __name__ == "__main__" : 
