Show
Ignore:
Timestamp:
11/15/04 16:14:06 (20 years ago)
Author:
jalet
Message:

Preliminary integration of Matt's patch for banners.

Files:
1 modified

Legend:

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

    r1875 r1914  
    2222# 
    2323# $Log$ 
     24# Revision 1.55  2004/11/15 15:14:06  jalet 
     25# Preliminary integration of Matt's patch for banners. 
     26# 
    2427# Revision 1.54  2004/10/25 14:12:25  jalet 
    2528# For URGENT legal reasons (Italy), a new "privacy" directive was added to pykota.conf 
     
    490493            gd = self.getPrinterOption(printername, "gracedelay") 
    491494        except PyKotaConfigError :     
    492             gd = 7 
     495            gd = 7      # default value of 7 days 
    493496        try : 
    494497            return int(gd) 
     
    501504            pm = self.getGlobalOption("poorman") 
    502505        except PyKotaConfigError :     
    503             pm = 1.0 
     506            pm = 1.0    # default value of 1 unit 
    504507        try : 
    505508            return float(pm) 
     
    555558        """Returns the winbind separator's value if it is set, else None.""" 
    556559        return self.getGlobalOption("winbind_separator", ignore=1) 
     560 
     561    def getAccountBanner(self, printername) : 
     562        """Returns which banner(s) to account for: NONE, BOTH, STARTING, ENDING.""" 
     563        validvalues = [ "NONE", "BOTH", "STARTING", "ENDING" ]      
     564        try : 
     565            value = self.getPrinterOption(printername, "accountbanner") 
     566        except PyKotaConfigError :     
     567            return "BOTH"       # Default value of BOTH 
     568        else :     
     569            value = value.upper() 
     570            if value not in validvalues : 
     571                raise PyKotaConfigError, _("Option onaccountererror in section %s only supports values in %s") % (printername, str(validvalues)) 
     572            return value   
     573 
     574    def getStartingBanner(self, printername) : 
     575        """Returns the startingbanner value if set, else None.""" 
     576        try : 
     577            return self.getPrinterOption(printername, "startingbanner") 
     578        except PyKotaConfigError : 
     579            return None 
     580 
     581    def getEndingBanner(self, printername) : 
     582        """Returns the endingbanner value if set, else None.""" 
     583        try : 
     584            return self.getPrinterOption(printername, "endingbanner") 
     585        except PyKotaConfigError : 
     586            return None