Changeset 843
- Timestamp:
- 03/10/03 00:56:21 (22 years ago)
- Location:
- pykota/trunk/bin
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/edpykota
r825 r843 17 17 # 18 18 # $Log$ 19 # Revision 1.25 2003/03/09 23:56:21 jalet 20 # Option noquota added to do accounting only. 21 # 19 22 # Revision 1.24 2003/02/27 23:48:41 jalet 20 23 # Correctly maps PyKota's log levels to syslog log levels … … 128 131 print quotas 129 132 133 -n | --noquota Doesn't set a quota but only does accounting. 134 130 135 -r | --reset Resets the printed page counter for the user 131 136 or group to zero. The life time page counter … … 170 175 well as every user whose name begins with 'jo'. 171 176 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. 172 183 173 184 This program is free software; you can redistribute it and/or modify … … 239 250 softlimit = hardlimit 240 251 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)) : 242 253 raise PyKotaToolError, _("Both hard and soft limits must be set ! Aborting.") 243 254 if options["add"] : … … 276 287 else : 277 288 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)) : 279 290 self.storage.setUserPQuota(name, printer, softlimit, hardlimit) 280 291 if options["reset"] : 281 292 self.storage.resetUserPQuota(name, printer) 282 293 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)) : 284 295 self.storage.setGroupPQuota(name, printer, softlimit, hardlimit) 285 296 if options["reset"] : … … 293 304 "printer" : "*", \ 294 305 } 295 short_options = "vh augrp: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="] 297 308 298 309 # Initializes the command line tool … … 313 324 options["hardlimit"] = options["H"] or options["hardlimit"] 314 325 options["reset"] = options["r"] or options["reset"] 326 options["noquota"] = options["n"] or options["noquota"] 315 327 316 328 if options["help"] : … … 319 331 editor.display_version_and_quit() 320 332 elif options["users"] and options["groups"] : 321 raise PyKotaToolError, _(" edpykota: options --users and --groups are incompatible.")333 raise PyKotaToolError, _("incompatible options, see help.") 322 334 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.") 324 338 elif options["groups"] : 325 raise PyKotaToolError, _(" edpykota:option --groups is currently not implemented.")339 raise PyKotaToolError, _("option --groups is currently not implemented.") 326 340 else : 327 341 sys.exit(editor.main(args, options)) -
pykota/trunk/bin/repykota
r842 r843 17 17 # 18 18 # $Log$ 19 # Revision 1.16 2003/03/09 23:56:21 jalet 20 # Option noquota added to do accounting only. 21 # 19 22 # Revision 1.15 2003/03/09 23:39:14 jalet 20 23 # Simplified translations. … … 159 162 lifepagecounter = quota["lifepagecounter"] 160 163 pagecounter = quota["pagecounter"] 161 softlimit = quota["softlimit"] or 0162 hardlimit = quota["hardlimit"] or 0164 softlimit = quota["softlimit"] 165 hardlimit = quota["hardlimit"] 163 166 datelimit = quota["datelimit"] 164 167 if datelimit is not None : … … 169 172 else : 170 173 datelimit = "" 171 reached = (( pagecounter >= softlimit) and "+") or "-"172 print "%-10.10s %c %8i %8 i %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) 173 176 return lifepagecounter 174 177