Changeset 2452 for pykota/trunk/bin/edpykota
- Timestamp:
- 09/17/05 16:29:43 (19 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/edpykota
r2344 r2452 100 100 101 101 -n | --noquota Doesn't set a quota but only does accounting. 102 This is the same as --limitby noquota. 102 103 103 104 -r | --reset Resets the actual page counter for the user … … 112 113 by its account balance or by its page quota. 113 114 The default value is 'quota'. Allowed values 114 are 'quota' 'balance' 'quota-then-balance' and 115 'balance-then-quota'. 116 WARNING : quota-then-balance and balance-then-quota 117 are not yet implemented. 115 are 'quota' 'balance' 'noquota' 'noprint' 116 and 'nochange' : 117 118 - quota : limit by number of pages per printer. 119 - balance : limit by number of credits in account. 120 - noquota : no limit, accounting still done. 121 - nochange : no limit, accounting not done. 122 - noprint : printing is denied. 123 NB : nochange and noprint are not supported for groups. 118 124 119 125 -b | --balance b Sets the user's account balance to b. … … 125 131 Groups don't have a real balance, but the 126 132 sum of their users' account balance. 133 134 -C | --comment txt Defines some informational text to be associated 135 with a change to an user's account balance. 136 Only meaningful if -b | --balance is also used. 127 137 128 138 -S | --softlimit sl Sets the quota soft limit to sl pages. … … 237 247 238 248 softlimit = hardlimit = None 249 250 if options["noquota"] : 251 options["limitby"] = "noquota" 252 253 limitby = options["limitby"] 254 if limitby : 255 limitby = limitby.strip().lower() 256 if limitby : 257 if limitby not in ('quota', 'balance', 'noquota', \ 258 'noprint', 'nochange') : 259 raise PyKotaToolError, _("Invalid limitby value %s") % options["limitby"] 260 if limitby in ('noquota', 'nochange') : 261 options["noquota"] = 1 262 if (limitby in ('nochange', 'noprint')) and options["groups"] : 263 raise PyKotaToolError, _("Invalid limitby value %s") % options["limitby"] 239 264 240 265 used = options["used"] … … 288 313 charges = [charges[0], None] 289 314 290 limitby = options["limitby"]291 if limitby :292 limitby = limitby.strip().lower()293 if limitby and (limitby not in ('quota', 'balance', 'quota-then-balance', 'balance-then-quota')) :294 raise PyKotaToolError, _("Invalid limitby value %s") % options["limitby"]295 296 315 if options["ingroups"] : 297 316 groupnames = [gname.strip() for gname in options["ingroups"].split(',')] … … 474 493 newbalance = float(entry.AccountBalance or 0.0) + balancevalue 475 494 newlifetimepaid = float(entry.LifeTimePaid or 0.0) + balancevalue 476 entry.setAccountBalance(newbalance, newlifetimepaid )495 entry.setAccountBalance(newbalance, newlifetimepaid, options["comment"]) 477 496 else : 478 497 diff = balancevalue - float(entry.AccountBalance or 0.0) 479 498 newlifetimepaid = float(entry.LifeTimePaid or 0.0) + diff 480 entry.setAccountBalance(balancevalue, newlifetimepaid )499 entry.setAccountBalance(balancevalue, newlifetimepaid, options["comment"]) 481 500 changed[entry.Name]["balance"] = balance 482 501 … … 506 525 defaults = { \ 507 526 "printer" : "*", \ 527 "comment" : "", \ 508 528 } 509 short_options = "vhdo:c:l:b:i:naugrp:P:S:H:G:RU:" 510 long_options = ["help", "version", "overcharge=", "charge=", "delete", "limitby=", "balance=", "ingroups=", "noquota", "add", "users", "groups", "reset", "hardreset", "prototype=", "printer=", "softlimit=", "hardlimit=", "pgroups=", "used="] 529 short_options = "vhdo:c:C:l:b:i:naugrp:P:S:H:G:RU:" 530 long_options = ["help", "version", "comment=", \ 531 "overcharge=", "charge=", "delete", "limitby=", \ 532 "balance=", "ingroups=", "noquota", "add", "users", \ 533 "groups", "reset", "hardreset", "prototype=", \ 534 "printer=", "softlimit=", "hardlimit=", "pgroups=", \ 535 "used="] 511 536 512 537 # Initializes the command line tool … … 538 563 options["used"] = options["U"] or options["used"] 539 564 options["overcharge"] = options["o"] or options["overcharge"] 565 options["comment"] = options["C"] or options["comment"] or defaults["comment"] 540 566 541 567 if options["help"] : … … 553 579 elif options["groups"] and (options["balance"] or options["ingroups"] or options["used"] or options["overcharge"]) : 554 580 raise PyKotaToolError, _("incompatible options, see help.") 581 elif options["comment"] and not options["balance"] : 582 raise PyKotaToolError, _("incompatible options, see help.") 555 583 else : 556 584 retcode = editor.main(args, options)