Changeset 852 for pykota/trunk/pykota
- Timestamp:
- 03/16/03 00:01:28 (21 years ago)
- Location:
- pykota/trunk/pykota
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/config.py
r804 r852 15 15 # 16 16 # $Log$ 17 # Revision 1.17 2003/03/15 23:01:28 jalet 18 # New mailto option in configuration file added. 19 # No time to test this tonight (although it should work). 20 # 17 21 # Revision 1.16 2003/02/17 23:01:56 jalet 18 22 # Typos … … 189 193 return self.getPrinterOption(printer, "admin") 190 194 195 def getMailTo(self, printer) : 196 """Returns the recipient of email messages.""" 197 validmailtos = [ "DEVNULL", "BOTH", "USER", "ADMIN" ] 198 mailto = self.getPrinterOption(printer, "mailto").upper() 199 if mailto not in validmailtos : 200 raise PyKotaConfigError, _("Option mailto in section %s only supports values in %s") % (printer, str(validmailtos)) 201 return mailto 202 191 203 def getGraceDelay(self, printer) : 192 204 """Returns the grace delay in days.""" -
pykota/trunk/pykota/tool.py
r844 r852 15 15 # 16 16 # $Log$ 17 # Revision 1.27 2003/03/15 23:01:28 jalet 18 # New mailto option in configuration file added. 19 # No time to test this tonight (although it should work). 20 # 17 21 # Revision 1.26 2003/03/09 23:58:16 jalet 18 22 # Comment … … 312 316 admin = self.config.getAdmin(pname) 313 317 adminmail = self.config.getAdminMail(pname) 318 mailto = self.config.getMailTo(pname) 314 319 action = self.checkUserPQuota(username, pname) 315 320 if action.startswith("POLICY_") : … … 318 323 adminmessage = _("Print Quota exceeded for user %s on printer %s") % (username, pname) 319 324 self.logger.log_message(adminmessage) 320 self.sendMessageToUser(admin, adminmail, username, _("Print Quota Exceeded"), _("You are not allowed to print anymore because\nyour Print Quota is exceeded on printer %s.") % pname) 321 self.sendMessageToAdmin(adminmail, _("Print Quota"), adminmessage) 325 if mailto in [ "BOTH", "USER" ] : 326 self.sendMessageToUser(admin, adminmail, username, _("Print Quota Exceeded"), _("You are not allowed to print anymore because\nyour Print Quota is exceeded on printer %s.") % pname) 327 if mailto in [ "BOTH", "ADMIN" ] : 328 self.sendMessageToAdmin(adminmail, _("Print Quota"), adminmessage) 322 329 elif action == "WARN" : 323 330 adminmessage = _("Print Quota soft limit exceeded for user %s on printer %s") % (username, pname) 324 331 self.logger.log_message(adminmessage) 325 self.sendMessageToUser(admin, adminmail, username, _("Print Quota Exceeded"), _("You will soon be forbidden to print anymore because\nyour Print Quota is almost reached on printer %s.") % pname) 326 self.sendMessageToAdmin(adminmail, _("Print Quota"), adminmessage) 332 if mailto in [ "BOTH", "USER" ] : 333 self.sendMessageToUser(admin, adminmail, username, _("Print Quota Exceeded"), _("You will soon be forbidden to print anymore because\nyour Print Quota is almost reached on printer %s.") % pname) 334 if mailto in [ "BOTH", "ADMIN" ] : 335 self.sendMessageToAdmin(adminmail, _("Print Quota"), adminmessage) 327 336 return action 328 337