Changeset 924
- Timestamp:
- 04/16/03 10:22:10 (22 years ago)
- Location:
- pykota/trunk
- Files:
-
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/edpykota
r923 r924 23 23 # 24 24 # $Log$ 25 # Revision 1.40 2003/04/16 08:22:09 jalet 26 # More strict error detection. 27 # Minor code rewrite to avoid some repetitive tests. 28 # 25 29 # Revision 1.39 2003/04/16 08:01:53 jalet 26 30 # edpykota --charge command line option works now. … … 317 321 else : 318 322 raise PyKotaToolError, _("There's no printer matching %s") % pname 323 319 324 softlimit = hardlimit = None 320 325 if options["softlimit"] : … … 332 337 self.logger.log_message(_("Hard limit %i is less than soft limit %i, values will be exchanged.") % (hardlimit, softlimit)) 333 338 (softlimit, hardlimit) = (hardlimit, softlimit) 339 334 340 if not names : 335 341 if options["add"] and not printeradded : … … 337 343 else : 338 344 names = [ "*" ] # all users 345 346 balance = options["balance"] 347 if balance : 348 balance = balance.strip() 349 try : 350 balancevalue = float(balance) 351 except ValueError : 352 raise PyKotaToolError, _("Invalid balance value %s" % options["balance"]) 353 339 354 if options["charge"] : 340 355 try : … … 345 360 if len(charges) < 2 : 346 361 charges.append(None) 362 363 limitby = options["limitby"] 364 if limitby : 365 limitby = limitby.strip().lower() 366 if limitby and (limitby not in ('quota', 'balance')) : 367 raise PyKotaToolError, _("Invalid limitby value %s" % options["limitby"]) 368 347 369 for (printerid, printer) in printers : 348 370 if options["charge"] : … … 416 438 self.storage.deleteUser(ident) 417 439 else : 418 limitby = options["limitby"]419 if limitby :420 limitby = limitby.lower()421 if limitby and (limitby not in ('quota', 'balance')) :422 limitby = 'quota'423 440 if options["groups"] : 424 441 if options["noquota"] or options["prototype"] or ((softlimit is not None) and (hardlimit is not None)) : … … 436 453 if limitby : 437 454 self.storage.limitUserBy(ident, limitby) 438 balance = options["balance"]439 455 if balance : 440 balance = balance.strip() 441 try : 442 balancevalue = float(balance) 443 except ValueError : 444 pass # TODO : log something when incorrect balance value 445 else : 446 if balance.startswith("+") or balance.startswith("-") : 447 self.storage.increaseUserBalance(ident, balancevalue) 448 else : 449 self.storage.setUserBalance(ident, balancevalue) 456 if balance.startswith("+") or balance.startswith("-") : 457 self.storage.increaseUserBalance(ident, balancevalue) 458 else : 459 self.storage.setUserBalance(ident, balancevalue) 450 460 self.warnUserPQuota(name, printer) 451 461 -
pykota/trunk/po/en/pykota.po
r923 r924 21 21 # 22 22 # $Log$ 23 # Revision 1.16 2003/04/16 08:22:09 jalet 24 # More strict error detection. 25 # Minor code rewrite to avoid some repetitive tests. 26 # 23 27 # Revision 1.15 2003/04/16 08:01:54 jalet 24 28 # edpykota --charge command line option works now. … … 261 265 msgid "Invalid charge amount value %s" 262 266 msgstr "" 267 268 msgid "Invalid balance value %s" 269 msgstr "" 270 271 msgid "Invalid limitby value %s" 272 msgstr "" -
pykota/trunk/po/fr/pykota.po
r923 r924 21 21 # 22 22 # $Log$ 23 # Revision 1.14 2003/04/16 08:22:10 jalet 24 # More strict error detection. 25 # Minor code rewrite to avoid some repetitive tests. 26 # 23 27 # Revision 1.13 2003/04/16 08:01:54 jalet 24 28 # edpykota --charge command line option works now. … … 268 272 269 273 msgid "Invalid charge amount value %s" 270 msgstr "Montant �omptabiliser %s incorrect" 274 msgstr "Montant �omptabiliser %s invalide" 275 276 msgid "Invalid balance value %s" 277 msgstr "Valeur %s du solde invalide" 278 279 msgid "Invalid limitby value %s" 280 msgstr "Valeur de l'option limitby %s invalide" -
pykota/trunk/po/pykota.pot
r923 r924 21 21 # 22 22 # $Log$ 23 # Revision 1.16 2003/04/16 08:22:09 jalet 24 # More strict error detection. 25 # Minor code rewrite to avoid some repetitive tests. 26 # 23 27 # Revision 1.15 2003/04/16 08:01:54 jalet 24 28 # edpykota --charge command line option works now. … … 261 265 msgid "Invalid charge amount value %s" 262 266 msgstr "" 267 268 msgid "Invalid balance value %s" 269 msgstr "" 270 271 msgid "Invalid limitby value %s" 272 msgstr ""