Changeset 843 for pykota/trunk

Show
Ignore:
Timestamp:
03/10/03 00:56:21 (22 years ago)
Author:
jalet
Message:

Option noquota added to do accounting only.

Location:
pykota/trunk/bin
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/edpykota

    r825 r843  
    1717# 
    1818# $Log$ 
     19# Revision 1.25  2003/03/09 23:56:21  jalet 
     20# Option noquota added to do accounting only. 
     21# 
    1922# Revision 1.24  2003/02/27 23:48:41  jalet 
    2023# Correctly maps PyKota's log levels to syslog log levels 
     
    128131                       print quotas 
    129132                        
     133  -n | --noquota       Doesn't set a quota but only does accounting. 
     134   
    130135  -r | --reset         Resets the printed page counter for the user 
    131136                       or group to zero. The life time page counter  
     
    170175  well as every user whose name begins with 'jo'. 
    171176  Their life time page counter on each printer will be kept unchanged. 
     177   
     178  $ edpykota --noquota jerome 
     179   
     180  This will tell PyKota to not limit jerome when printing. All his 
     181  jobs will be allowed, but accounting of the pages he used will 
     182  still be kept. 
    172183 
    173184This program is free software; you can redistribute it and/or modify 
     
    239250                softlimit = hardlimit 
    240251                self.logger.log_message(_("Undefined soft limit set to hard limit (%s) on printer %s.") % (str(softlimit), printer)) 
    241             if (not options["reset"]) and ((hardlimit is None) or (softlimit is None)) :         
     252            if (not options["reset"] and not options["noquota"]) and ((hardlimit is None) or (softlimit is None)) : 
    242253                raise PyKotaToolError, _("Both hard and soft limits must be set ! Aborting.") 
    243254            if options["add"] :     
     
    276287                else :     
    277288                    if options["users"] : 
    278                         if (softlimit is not None) and (hardlimit is not None) : 
     289                        if options["noquota"] or ((softlimit is not None) and (hardlimit is not None)) : 
    279290                            self.storage.setUserPQuota(name, printer, softlimit, hardlimit) 
    280291                        if options["reset"] : 
    281292                            self.storage.resetUserPQuota(name, printer) 
    282293                    else : 
    283                         if (softlimit is not None) and (hardlimit is not None) : 
     294                        if options["noquota"] or ((softlimit is not None) and (hardlimit is not None)) : 
    284295                            self.storage.setGroupPQuota(name, printer, softlimit, hardlimit) 
    285296                        if options["reset"] : 
     
    293304                     "printer" : "*", \ 
    294305                   } 
    295         short_options = "vhaugrp:P:S:H:" 
    296         long_options = ["help", "version", "add", "users", "groups", "reset", "prototype=", "printer=", "softlimit=", "hardlimit="] 
     306        short_options = "vhnaugrp:P:S:H:" 
     307        long_options = ["help", "version", "noquota", "add", "users", "groups", "reset", "prototype=", "printer=", "softlimit=", "hardlimit="] 
    297308         
    298309        # Initializes the command line tool 
     
    313324        options["hardlimit"] = options["H"] or options["hardlimit"]  
    314325        options["reset"] = options["r"] or options["reset"]  
     326        options["noquota"] = options["n"] or options["noquota"] 
    315327         
    316328        if options["help"] : 
     
    319331            editor.display_version_and_quit() 
    320332        elif options["users"] and options["groups"] :     
    321             raise PyKotaToolError, _("edpykota: options --users and --groups are incompatible.") 
     333            raise PyKotaToolError, _("incompatible options, see help.") 
    322334        elif (options["softlimit"] or options["hardlimit"]) and options["prototype"] :     
    323             raise PyKotaToolError, _("edpykota: options --softlimit or --hardlimit and --prototype are incompatible.") 
     335            raise PyKotaToolError, _("incompatible options, see help.") 
     336        elif options["noquota"] and (options["prototype"] or options["hardlimit"] or options["softlimit"]) : 
     337            raise PyKotaToolError, _("incompatible options, see help.") 
    324338        elif options["groups"] :     
    325             raise PyKotaToolError, _("edpykota: option --groups is currently not implemented.") 
     339            raise PyKotaToolError, _("option --groups is currently not implemented.") 
    326340        else : 
    327341            sys.exit(editor.main(args, options)) 
  • pykota/trunk/bin/repykota

    r842 r843  
    1717# 
    1818# $Log$ 
     19# Revision 1.16  2003/03/09 23:56:21  jalet 
     20# Option noquota added to do accounting only. 
     21# 
    1922# Revision 1.15  2003/03/09 23:39:14  jalet 
    2023# Simplified translations. 
     
    159162            lifepagecounter = quota["lifepagecounter"] 
    160163            pagecounter = quota["pagecounter"] 
    161             softlimit = quota["softlimit"] or 0 
    162             hardlimit = quota["hardlimit"] or 0 
     164            softlimit = quota["softlimit"] 
     165            hardlimit = quota["hardlimit"] 
    163166            datelimit = quota["datelimit"] 
    164167            if datelimit is not None : 
     
    169172            else :     
    170173                datelimit = "" 
    171             reached = ((pagecounter >= softlimit) and "+") or "-" 
    172             print "%-10.10s %c %8i %8i %8i %10s %9i" % (name, reached, pagecounter, softlimit, hardlimit, str(datelimit)[:10], lifepagecounter) 
     174            reached = ((softlimit is not None) and (pagecounter >= softlimit) and "+") or "-" 
     175            print "%-10.10s %c %8i %8s %8s %10s %9i" % (name, reached, pagecounter, str(softlimit), str(hardlimit), str(datelimit)[:10], lifepagecounter) 
    173176            return lifepagecounter 
    174177