Changeset 852 for pykota/trunk

Show
Ignore:
Timestamp:
03/16/03 00:01:28 (22 years ago)
Author:
jalet
Message:

New mailto option in configuration file added.
No time to test this tonight (although it should work).

Location:
pykota/trunk
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/conf/pykota.conf.sample

    r830 r852  
    4848 
    4949# 
     50# Who should we send an email to in case a quota is reached ? 
     51# possible values are : DevNull, User, Admin, Both 
     52# The Both value means that the User and the Admin will receive  
     53# an email message. 
     54# The DevNull value means no email message will be sent. 
     55# This value can be set either globally or per printer or both. 
     56# If both are defined, the printer option has priority. 
     57mailto: both 
     58 
     59# 
    5060# Grace delay in days 
    5161# This value can be set either globally or per printer or both. 
  • pykota/trunk/NEWS

    r846 r852  
    1616PyKota NEWS : 
    1717 
     18    - 1.01 : 
     19     
     20        - The configuration file now accepts an option    
     21          to choose the recipient(s) of the email messages : 
     22           
     23            - DevNull means no one will receive them. 
     24            - User means only the user will receive them. 
     25            - Admin means only the admin will receive them. 
     26            - Both means the User and the Admin will receive them. 
     27             
     28        - Manual pages are included since 1.00, but I forgot to     
     29          add this information to this file. 
     30           
    1831    - 1.00 : 
    1932     
  • pykota/trunk/po/en/pykota.po

    r842 r852  
    1515# 
    1616# $Log$ 
     17# Revision 1.10  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# 
    1721# Revision 1.9  2003/03/09 23:38:43  jalet 
    1822# Simplified translations. 
     
    219223msgid "unknown" 
    220224msgstr "" 
     225 
     226msgid "Option mailto in section %s only supports values in %s" 
     227msgstr "" 
  • pykota/trunk/po/fr/pykota.po

    r842 r852  
    1515# 
    1616# $Log$ 
     17# Revision 1.8  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# 
    1721# Revision 1.7  2003/03/09 23:38:43  jalet 
    1822# Simplified translations. 
     
    227231msgid "unknown" 
    228232msgstr "inconnu" 
     233 
     234msgid "Option mailto in section %s only supports values in %s" 
     235msgstr "L'option mailto dans la section %s supporte seulement les valeurs %s" 
  • pykota/trunk/po/pykota.pot

    r842 r852  
    1515# 
    1616# $Log$ 
     17# Revision 1.10  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# 
    1721# Revision 1.9  2003/03/09 23:38:43  jalet 
    1822# Simplified translations. 
     
    219223msgid "unknown" 
    220224msgstr "" 
     225 
     226msgid "Option mailto in section %s only supports values in %s" 
     227msgstr "" 
  • pykota/trunk/pykota/config.py

    r804 r852  
    1515# 
    1616# $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# 
    1721# Revision 1.16  2003/02/17 23:01:56  jalet 
    1822# Typos 
     
    189193        return self.getPrinterOption(printer, "admin") 
    190194         
     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         
    191203    def getGraceDelay(self, printer) :     
    192204        """Returns the grace delay in days.""" 
  • pykota/trunk/pykota/tool.py

    r844 r852  
    1515# 
    1616# $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# 
    1721# Revision 1.26  2003/03/09 23:58:16  jalet 
    1822# Comment 
     
    312316        admin = self.config.getAdmin(pname) 
    313317        adminmail = self.config.getAdminMail(pname) 
     318        mailto = self.config.getMailTo(pname) 
    314319        action = self.checkUserPQuota(username, pname) 
    315320        if action.startswith("POLICY_") : 
     
    318323            adminmessage = _("Print Quota exceeded for user %s on printer %s") % (username, pname) 
    319324            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) 
    322329        elif action == "WARN" :     
    323330            adminmessage = _("Print Quota soft limit exceeded for user %s on printer %s") % (username, pname) 
    324331            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) 
    327336        return action         
    328337