Show
Ignore:
Timestamp:
04/16/03 10:01:54 (21 years ago)
Author:
jalet
Message:

edpykota --charge command line option works now.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/edpykota

    r922 r923  
    2323# 
    2424# $Log$ 
     25# Revision 1.39  2003/04/16 08:01:53  jalet 
     26# edpykota --charge command line option works now. 
     27# 
    2528# Revision 1.38  2003/04/15 22:02:43  jalet 
    2629# More complete docstring 
     
    334337            else :     
    335338                names = [ "*" ] # all users 
     339        if options["charge"] : 
     340            try : 
     341                charges = [float(part) for part in options["charge"].split(',', 1)] 
     342            except ValueError :     
     343                raise PyKotaToolError, _("Invalid charge amount value %s" % options["charge"]) 
     344            else :     
     345                if len(charges) < 2 : 
     346                    charges.append(None) 
    336347        for (printerid, printer) in printers : 
     348            if options["charge"] : 
     349                (perpage, perjob) = charges 
     350                if perjob is None : 
     351                    # we don't want to change this one, get the old value 
     352                    (dummy, perjob) = self.storage.getPrinterPrices(printerid) 
     353                self.storage.setPrinterPrices(printerid, perpage, perjob)     
    337354            if options["prototype"] : 
    338355                if options["groups"] : 
     
    354371                if softlimit is not None : 
    355372                    self.logger.log_message(_("Undefined soft limit set to hard limit (%s) on printer %s.") % (str(softlimit), printer)) 
    356             if (not options["reset"] and not options["noquota"] and not options["prototype"] and not options["limitby"] and not options["balance"] and not options["delete"]) and ((hardlimit is None) or (softlimit is None)) : 
     373            if (not options["reset"] and not options["noquota"] and not options["prototype"] and not options["limitby"] and not options["balance"] and not options["delete"] and not options["charge"]) and ((hardlimit is None) or (softlimit is None)) : 
    357374                raise PyKotaToolError, _("Both hard and soft limits must be set ! Aborting.") 
    358375            if options["add"] :