Changeset 2739 for pykota

Show
Ignore:
Timestamp:
02/21/06 17:26:04 (19 years ago)
Author:
jerome
Message:

Fixed the problem with deletion time.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/edpykota

    r2738 r2739  
    159159        suffix = (options["groups"] and "Group") or "User"         
    160160        printernames = options["printer"].split(",") 
    161         if not names : 
    162             names = ["*"] 
    163         (printers, entries, pqentries) = getattr(self.storage, "getPrinters%ssAndPQuotas" % suffix)(printernames, names) 
    164161         
    165162        if options["delete"] :     
    166163            self.display("%s...\n" % _("Deletion")) 
    167             nbtotal = len(pqentries) 
     164            printers = self.storage.getMatchingPrinters(options["printer"]) 
     165            entries = getattr(self.storage, "getMatching%ss" % suffix)(",".join(names)) 
     166            nbtotal = len(entries) * len(printers) 
    168167            i = 0 
    169             for (pqkey, pqentry) in pqentries.items() : 
    170                 if pqentry.Exists : 
    171                     pqentry.delete() 
    172                 i += 1     
    173                 percent = 100.0 * float(i) / float(nbtotal) 
    174                 self.display("\r%.02f%%" % percent) 
     168            for printer in printers : 
     169                for entry in entries : 
     170                    pqentry = getattr(self.storage, "get%sPQuota" % suffix)(entry, printer) 
     171                    if pqentry.Exists : 
     172                        pqentry.delete() 
     173                    i += 1     
     174                    percent = 100.0 * float(i) / float(nbtotal) 
     175                    self.display("\r%.02f%%" % percent) 
    175176        else : 
     177            if not names : 
     178                names = ["*"] 
     179            (printers, entries, pqentries) = getattr(self.storage, "getPrinters%ssAndPQuotas" % suffix)(printernames, names) 
    176180            skipexisting = options["skipexisting"] 
    177181            if options["add"] :