Changeset 1077
- Timestamp:
- 07/08/03 21:43:51 (21 years ago)
- Location:
- pykota/trunk
- Files:
-
- 9 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/conf/pykota.conf.sample
r1055 r1077 153 153 gracedelay: 7 154 154 155 # 156 # Poor man's threshold 157 # If account balance reaches below this amount, 158 # a warning message is sent by email 159 # 160 # If unset, default poor man's threshold is 1.0. 161 # This option can only appear in the global section 162 poorman: 2.0 163 164 # Poor man's warning message 165 # The warning message that is sent if the "poorman" value is reached 166 # Again this must appear in the global section 167 poorwarn: Your Print Quota account balance is low. 168 Soon you'll not be allowed to print anymore. 169 170 # Soft limit reached warning message 171 # The warning message that is sent if the soft quota limit is reached 172 # May appear either globally or on a per-printer basis 173 softwarn: Your Print Quota Soft Limit is reached. 174 This means that you may still be allowed to print for some 175 time, but you must contact your administrator to purchase 176 more print quota. 177 178 # Hard limit reached error message 179 # The error message that is sent if the hard quota limit is reached 180 # May appear either globally or on a per-printer basis 181 hardwarn: Your Print Quota Hard Limit is reached. 182 This means that you are not allowed to print anymore. 183 Please contact your administrator at root@localhost 184 as soon as possible to solve the problem. 185 155 186 # one section per printer, or no other section at all if all options 156 187 # are defined globally. -
pykota/trunk/NEWS
r1072 r1077 22 22 PyKota NEWS : 23 23 24 - 1.14alpha1 : 25 26 - Poor man's treshold included : users with a low account 27 balance (below 1.0 by default, configurable) are sent 28 a warning message. 29 30 - All warning messages to users are now configurable. 31 NB : Warning messages to the administrator are not. 32 24 33 - 1.13 : 25 34 -
pykota/trunk/po/en/pykota.po
r1058 r1077 21 21 # 22 22 # $Log$ 23 # Revision 1.31 2003/07/08 19:43:50 jalet 24 # Configurable warning messages. 25 # Poor man's treshold value added. 26 # 23 27 # Revision 1.30 2003/07/03 11:38:44 jalet 24 28 # Translations for pykotme added … … 325 329 msgstr "" 326 330 331 msgid "Print Quota soft limit exceeded for group %s on printer %s" 332 msgstr "" 333 334 msgid "Totals may be inaccurate if some users are members of several groups." 335 msgstr "" 336 337 msgid "Price per job: %.3f" 338 msgstr "" 339 340 msgid "Price per page: %.3f" 341 msgstr "" 342 343 msgid "Group %s not found in the PyKota Storage." 344 msgstr "" 345 346 msgid "Unsupported accounter backend %s" 347 msgstr "" 348 349 msgid "Option accounter in section %s only supports values in %s" 350 msgstr "" 351 352 msgid "Option requester for printer %s was not set" 353 msgstr "" 354 355 msgid "Using the 'stupid' accounting method is unreliable." 356 msgstr "" 357 358 msgid "Invalid external accounter %s for printer %s" 359 msgstr "" 360 361 msgid "Unable to compute job size with external accounter %s" 362 msgstr "" 363 364 msgid "Search for %s(%s) from %s(scope=%s) returned no answer." 365 msgstr "" 366 367 msgid "Problem adding LDAP entry (%s, %s)" 368 msgstr "" 369 370 msgid "Problem modifying LDAP entry (%s, %s)" 371 msgstr "" 372 373 msgid "Problem deleting LDAP entry (%s)" 374 msgstr "" 375 376 msgid "Impossible to add printer %s" 377 msgstr "" 378 379 msgid "Prototype object %s not found in Quota Storage." 380 msgstr "" 381 382 msgid "Impossible to send mail to %s, error %s : %s" 383 msgstr "" 384 385 msgid "Unsupported reporter backend %s" 386 msgstr "" 387 388 msgid "Unable to compute size of %s in number of pages.\n" 389 msgstr "" 390 391 msgid "Job size : %i pages" 392 msgstr "" 393 394 msgid "Cost on printer %s : %.2f" 395 msgstr "" 396 397 msgid "Invalid poor man's treshold %s" 398 msgstr "" 399 327 400 msgid "" 328 "You are not allowed to print anymore because\n" 329 "your group Print Quota is exceeded on printer %s." 330 msgstr "" 331 332 msgid "Print Quota soft limit exceeded for group %s on printer %s" 333 msgstr "" 334 335 msgid "" 336 "You will soon be forbidden to print anymore because\n" 337 "your group Print Quota is almost reached on printer %s." 338 msgstr "" 339 340 msgid "Totals may be inaccurate if some users are members of several groups." 341 msgstr "" 342 343 msgid "Price per job: %.3f" 344 msgstr "" 345 346 msgid "Price per page: %.3f" 347 msgstr "" 348 349 msgid "Group %s not found in the PyKota Storage." 350 msgstr "" 351 352 msgid "Unsupported accounter backend %s" 353 msgstr "" 354 355 msgid "Option accounter in section %s only supports values in %s" 356 msgstr "" 357 358 msgid "Option requester for printer %s was not set" 359 msgstr "" 360 361 msgid "Using the 'stupid' accounting method is unreliable." 362 msgstr "" 363 364 msgid "Invalid external accounter %s for printer %s" 365 msgstr "" 366 367 msgid "Unable to compute job size with external accounter %s" 368 msgstr "" 369 370 msgid "Search for %s(%s) from %s(scope=%s) returned no answer." 371 msgstr "" 372 373 msgid "Problem adding LDAP entry (%s, %s)" 374 msgstr "" 375 376 msgid "Problem modifying LDAP entry (%s, %s)" 377 msgstr "" 378 379 msgid "Problem deleting LDAP entry (%s)" 380 msgstr "" 381 382 msgid "Impossible to add printer %s" 383 msgstr "" 384 385 msgid "Prototype object %s not found in Quota Storage." 386 msgstr "" 387 388 msgid "Impossible to send mail to %s, error %s : %s" 389 msgstr "" 390 391 msgid "Unsupported reporter backend %s" 392 msgstr "" 393 394 msgid "Unable to compute size of %s in number of pages.\n" 395 msgstr "" 396 397 msgid "Job size : %i pages" 398 msgstr "" 399 400 msgid "Cost on printer %s : %.2f" 401 msgstr "" 401 "Your Print Quota account balance is Low.\n" 402 "Soon you'll not be allowed to print anymore.\n" 403 "Please contact the Print Quota Administrator to solve the problem." 404 msgstr "" 405 406 msgid "Print Quota Low" 407 msgstr "" 408 -
pykota/trunk/po/fr/pykota.po
r1058 r1077 21 21 # 22 22 # $Log$ 23 # Revision 1.30 2003/07/08 19:43:51 jalet 24 # Configurable warning messages. 25 # Poor man's treshold value added. 26 # 23 27 # Revision 1.29 2003/07/03 11:38:44 jalet 24 28 # Translations for pykotme added … … 334 338 msgstr "D�ssement de Quota d'impression pour le groupe %s sur l'imprimante %s" 335 339 336 msgid ""337 "You are not allowed to print anymore because\n"338 "your group Print Quota is exceeded on printer %s."339 msgstr ""340 "Vous n'�s plus autoris� imprimer car\n"341 "le Quota d'Impression de votre groupe est d�ss�ur l'imprimante %s."342 343 340 msgid "Print Quota soft limit exceeded for group %s on printer %s" 344 341 msgstr "Limite souple de Quota d'Impression d�ss�pour le groupe %s sur l'imprimante %s" 345 346 msgid ""347 "You will soon be forbidden to print anymore because\n"348 "your group Print Quota is almost reached on printer %s."349 msgstr ""350 "Vous n'aurez bient�lus le droit d'imprimer car\n"351 "le Quota d'Impression de votre groupe sur l'imprimante %s est presque atteint."352 342 353 343 msgid "Totals may be inaccurate if some users are members of several groups." … … 411 401 msgid "Cost on printer %s : %.2f" 412 402 msgstr "Co�r l'imprimante %s : %.2f" 403 404 msgid "Invalid poor man's treshold %s" 405 msgstr "Valeur 'pauvre homme' %s invalide" 406 407 msgid "" 408 "Your Print Quota account balance is Low.\n" 409 "Soon you'll not be allowed to print anymore.\n" 410 "Please contact the Print Quota Administrator to solve the problem." 411 msgstr "" 412 "Le montant de votre compte d'impression est Bas.\n" 413 "Bient�ous ne serez plus autoris�) �mprimer.\n" 414 "Merci de contacter l'Administrateur de Quota d'Impression pour r�udre ce probl�." 415 416 msgid "Print Quota Low" 417 msgstr "Quota d'Impression Bas" 418 -
pykota/trunk/po/pykota.pot
r1058 r1077 21 21 # 22 22 # $Log$ 23 # Revision 1.31 2003/07/08 19:43:50 jalet 24 # Configurable warning messages. 25 # Poor man's treshold value added. 26 # 23 27 # Revision 1.30 2003/07/03 11:38:43 jalet 24 28 # Translations for pykotme added … … 325 329 msgstr "" 326 330 331 msgid "Print Quota soft limit exceeded for group %s on printer %s" 332 msgstr "" 333 334 msgid "Totals may be inaccurate if some users are members of several groups." 335 msgstr "" 336 337 msgid "Price per job: %.3f" 338 msgstr "" 339 340 msgid "Price per page: %.3f" 341 msgstr "" 342 343 msgid "Group %s not found in the PyKota Storage." 344 msgstr "" 345 346 msgid "Unsupported accounter backend %s" 347 msgstr "" 348 349 msgid "Option accounter in section %s only supports values in %s" 350 msgstr "" 351 352 msgid "Option requester for printer %s was not set" 353 msgstr "" 354 355 msgid "Using the 'stupid' accounting method is unreliable." 356 msgstr "" 357 358 msgid "Invalid external accounter %s for printer %s" 359 msgstr "" 360 361 msgid "Unable to compute job size with external accounter %s" 362 msgstr "" 363 364 msgid "Search for %s(%s) from %s(scope=%s) returned no answer." 365 msgstr "" 366 367 msgid "Problem adding LDAP entry (%s, %s)" 368 msgstr "" 369 370 msgid "Problem modifying LDAP entry (%s, %s)" 371 msgstr "" 372 373 msgid "Problem deleting LDAP entry (%s)" 374 msgstr "" 375 376 msgid "Impossible to add printer %s" 377 msgstr "" 378 379 msgid "Prototype object %s not found in Quota Storage." 380 msgstr "" 381 382 msgid "Impossible to send mail to %s, error %s : %s" 383 msgstr "" 384 385 msgid "Unsupported reporter backend %s" 386 msgstr "" 387 388 msgid "Unable to compute size of %s in number of pages.\n" 389 msgstr "" 390 391 msgid "Job size : %i pages" 392 msgstr "" 393 394 msgid "Cost on printer %s : %.2f" 395 msgstr "" 396 397 msgid "Invalid poor man's treshold %s" 398 msgstr "" 399 327 400 msgid "" 328 "You are not allowed to print anymore because\n" 329 "your group Print Quota is exceeded on printer %s." 330 msgstr "" 331 332 msgid "Print Quota soft limit exceeded for group %s on printer %s" 333 msgstr "" 334 335 msgid "" 336 "You will soon be forbidden to print anymore because\n" 337 "your group Print Quota is almost reached on printer %s." 338 msgstr "" 339 340 msgid "Totals may be inaccurate if some users are members of several groups." 341 msgstr "" 342 343 msgid "Price per job: %.3f" 344 msgstr "" 345 346 msgid "Price per page: %.3f" 347 msgstr "" 348 349 msgid "Group %s not found in the PyKota Storage." 350 msgstr "" 351 352 msgid "Unsupported accounter backend %s" 353 msgstr "" 354 355 msgid "Option accounter in section %s only supports values in %s" 356 msgstr "" 357 358 msgid "Option requester for printer %s was not set" 359 msgstr "" 360 361 msgid "Using the 'stupid' accounting method is unreliable." 362 msgstr "" 363 364 msgid "Invalid external accounter %s for printer %s" 365 msgstr "" 366 367 msgid "Unable to compute job size with external accounter %s" 368 msgstr "" 369 370 msgid "Search for %s(%s) from %s(scope=%s) returned no answer." 371 msgstr "" 372 373 msgid "Problem adding LDAP entry (%s, %s)" 374 msgstr "" 375 376 msgid "Problem modifying LDAP entry (%s, %s)" 377 msgstr "" 378 379 msgid "Problem deleting LDAP entry (%s)" 380 msgstr "" 381 382 msgid "Impossible to add printer %s" 383 msgstr "" 384 385 msgid "Prototype object %s not found in Quota Storage." 386 msgstr "" 387 388 msgid "Impossible to send mail to %s, error %s : %s" 389 msgstr "" 390 391 msgid "Unsupported reporter backend %s" 392 msgstr "" 393 394 msgid "Unable to compute size of %s in number of pages.\n" 395 msgstr "" 396 397 msgid "Job size : %i pages" 398 msgstr "" 399 400 msgid "Cost on printer %s : %.2f" 401 msgstr "" 401 "Your Print Quota account balance is Low.\n" 402 "Soon you'll not be allowed to print anymore.\n" 403 "Please contact the Print Quota Administrator to solve the problem." 404 msgstr "" 405 406 msgid "Print Quota Low" 407 msgstr "" 408 -
pykota/trunk/pykota/config.py
r1068 r1077 21 21 # 22 22 # $Log$ 23 # Revision 1.32 2003/07/08 19:43:51 jalet 24 # Configurable warning messages. 25 # Poor man's treshold value added. 26 # 23 27 # Revision 1.31 2003/07/07 11:49:24 jalet 24 28 # Lots of small fixes with the help of PyChecker … … 327 331 try : 328 332 return int(gd) 329 except ValueError:333 except (TypeError, ValueError) : 330 334 raise PyKotaConfigError, _("Invalid grace delay %s") % gd 335 336 def getPoorMan(self) : 337 """Returns the poor man's treshold.""" 338 try : 339 pm = self.getGlobalOption("poorman") 340 except PyKotaConfigError : 341 pm = 1.0 342 try : 343 return float(pm) 344 except (TypeError, ValueError) : 345 raise PyKotaConfigError, _("Invalid poor man's treshold %s") % pm 346 347 def getPoorWarn(self) : 348 """Returns the poor man's warning message.""" 349 try : 350 return self.getGlobalOption("poorwarn") 351 except PyKotaConfigError : 352 return _("Your Print Quota account balance is Low.\nSoon you'll not be allowed to print anymore.\nPlease contact the Print Quota Administrator to solve the problem.") 353 354 def getHardWarn(self, printer) : 355 """Returns the hard limit error message.""" 356 try : 357 return self.getPrinterOption(printer, "hardwarn") 358 except PyKotaConfigError : 359 return _("You are not allowed to print anymore because\nyour Print Quota is exceeded on printer %s.") % printer 360 361 def getSoftWarn(self, printer) : 362 """Returns the soft limit error message.""" 363 try : 364 return self.getPrinterOption(printer, "softwarn") 365 except PyKotaConfigError : 366 return _("You will soon be forbidden to print anymore because\nyour Print Quota is almost reached on printer %s.") % printer 331 367 332 368 def getDebug(self) : -
pykota/trunk/pykota/tool.py
r1068 r1077 21 21 # 22 22 # $Log$ 23 # Revision 1.45 2003/07/08 19:43:51 jalet 24 # Configurable warning messages. 25 # Poor man's treshold value added. 26 # 23 27 # Revision 1.44 2003/07/07 11:49:24 jalet 24 28 # Lots of small fixes with the help of PyChecker … … 337 341 printer = grouppquota.Printer 338 342 if group.LimitBy and (group.LimitBy.lower() == "balance") : 339 # TODO : there's no warning (no account balance soft limit) 340 if float(group.AccountBalance) <= 0.0 : 343 if group.AccountBalance <= 0.0 : 341 344 action = "DENY" 345 elif group.AccountBalance <= self.config.getPoorMan() : 346 action = "WARN" 342 347 else : 343 348 action = "ALLOW" … … 402 407 self.logger.log_message(_("Unable to find user %s's account balance, applying default policy (%s) for printer %s") % (user.Name, action, printer.Name)) 403 408 else : 404 # TODO : there's no warning (no account balance soft limit)405 if float(user.AccountBalance or 0.0)<= 0.0 :409 val = float(user.AccountBalance or 0.0) 410 if val <= 0.0 : 406 411 action = "DENY" 412 elif val <= self.config.getPoorMan() : 413 action = "WARN" 407 414 else : 408 415 action = "ALLOW" … … 470 477 for user in self.storage.getGroupMembers(group) : 471 478 if mailto in [ "BOTH", "USER" ] : 472 self.sendMessageToUser(admin, adminmail, user.Name, _("Print Quota Exceeded"), _("You are not allowed to print anymore because\nyour group Print Quota is exceeded on printer %s.") % printer.Name)479 self.sendMessageToUser(admin, adminmail, user.Name, _("Print Quota Exceeded"), self.config.getHardWarn(printer.Name)) 473 480 elif action == "WARN" : 474 481 adminmessage = _("Print Quota soft limit exceeded for group %s on printer %s") % (group.Name, printer.Name) … … 476 483 if mailto in [ "BOTH", "ADMIN" ] : 477 484 self.sendMessageToAdmin(adminmail, _("Print Quota"), adminmessage) 485 if group.LimitBy and (group.LimitBy.lower() == "balance") : 486 message = self.config.getPoorWarn() 487 else : 488 message = self.config.getSoftWarn(printer.Name) 478 489 for user in self.storage.getGroupMembers(group) : 479 490 if mailto in [ "BOTH", "USER" ] : 480 self.sendMessageToUser(admin, adminmail, user.Name, _("Print Quota Exceeded"), _("You will soon be forbidden to print anymore because\nyour group Print Quota is almost reached on printer %s.") % printer.Name)491 self.sendMessageToUser(admin, adminmail, user.Name, _("Print Quota Exceeded"), message) 481 492 return action 482 493 … … 495 506 self.logger.log_message(adminmessage) 496 507 if mailto in [ "BOTH", "USER" ] : 497 self.sendMessageToUser(admin, adminmail, user.Name, _("Print Quota Exceeded"), _("You are not allowed to print anymore because\nyour Print Quota is exceeded on printer %s.") % printer.Name)508 self.sendMessageToUser(admin, adminmail, user.Name, _("Print Quota Exceeded"), self.config.getHardWarn(printer.Name)) 498 509 if mailto in [ "BOTH", "ADMIN" ] : 499 510 self.sendMessageToAdmin(adminmail, _("Print Quota"), adminmessage) … … 502 513 self.logger.log_message(adminmessage) 503 514 if mailto in [ "BOTH", "USER" ] : 504 self.sendMessageToUser(admin, adminmail, user.Name, _("Print Quota Exceeded"), _("You will soon be forbidden to print anymore because\nyour Print Quota is almost reached on printer %s.") % printer.Name) 515 if user.LimitBy and (user.LimitBy.lower() == "balance") : 516 message = self.config.getPoorWarn() 517 else : 518 message = self.config.getSoftWarn(printer.Name) 519 self.sendMessageToUser(admin, adminmail, user.Name, _("Print Quota Low"), message) 505 520 if mailto in [ "BOTH", "ADMIN" ] : 506 521 self.sendMessageToAdmin(adminmail, _("Print Quota"), adminmessage) -
pykota/trunk/pykota/version.py
r1068 r1077 21 21 # 22 22 23 __version__ = "1.1 3_unofficial"23 __version__ = "1.14alpha1_unofficial" 24 24 25 25 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""