Show
Ignore:
Timestamp:
07/08/03 21:43:51 (21 years ago)
Author:
jalet
Message:

Configurable warning messages.
Poor man's treshold value added.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/config.py

    r1068 r1077  
    2121# 
    2222# $Log$ 
     23# Revision 1.32  2003/07/08 19:43:51  jalet 
     24# Configurable warning messages. 
     25# Poor man's treshold value added. 
     26# 
    2327# Revision 1.31  2003/07/07 11:49:24  jalet 
    2428# Lots of small fixes with the help of PyChecker 
     
    327331        try : 
    328332            return int(gd) 
    329         except ValueError :     
     333        except (TypeError, ValueError) :     
    330334            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 
    331367             
    332368    def getDebug(self) :