Changeset 1914

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

Preliminary integration of Matt's patch for banners.

Location:
pykota/trunk
Files:
2 modified

Legend:

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

    r1875 r1914  
    600600# posthook: /usr/bin/printenv >/tmp/after 
    601601 
     602# AccountBanner : how should banner accounting be done ? 
     603#  
     604# If enabled, banner pages printed from StartingBanner and/or EndingBanner  
     605# (depending on the value) will be included in the accounting for the 
     606# print job 
     607# 
     608# If disabled, banner pages printed from StartingBanner and EndingBanner will 
     609# *not* be included in the accounting for the print job 
     610# 
     611# IMPORTANT : CUPS generated banners are ALWAYS accounted for, although you 
     612#             can refund them by using negative prices on printers. 
     613# 
     614# Allowed values : Starting | Ending | None | Both 
     615# 
     616#       - Starting : only the starting banner will be accounted for. 
     617#       - Ending : only the ending banner will be accounted for. 
     618#       - Both : both starting and ending banners will be accounted for. 
     619#       - None : banners will not be accounted for. 
     620# 
     621# Default value : 
     622# accountbanner: Both 
     623 
     624# StartingBanner : if defined will print a banner before the rest of the job  
     625# is printed. The argument can be a printable file, or an executable file. 
     626# If not executable, the file will be printed as is. If executable, the  
     627# file will be executed and its output will be printed. 
     628#  
     629# In any case, the banner content which will be sent to the printer 
     630# MUST be in a format your printer will accept !!! 
     631# 
     632# The pkbanner command included in PyKota can automatically generate 
     633# starting and ending banners in the PostScript format. You can use 
     634# this command in a pipe through GhostScript if your printer doesn't  
     635# accept PostScript as an input format. 
     636# 
     637# startingbanner: /usr/share/pykota/banner-page.sh 
     638 
     639# EndingBanner : if defined will print a banner before the rest of the job  
     640# is printed. The argument can be a printable file, or an executable file. 
     641# If not executable, the file will be printed as is. If executable, the  
     642# file will be executed and its output will be printed. 
     643# 
     644# In any case, the banner content which will be sent to the printer 
     645# MUST be in a format your printer will accept !!! 
     646# 
     647# The pkbanner command included in PyKota can automatically generate 
     648# starting and ending banners in the PostScript format. You can use 
     649# this command in a pipe through GhostScript if your printer doesn't  
     650# accept PostScript as an input format. 
     651# 
     652# endingbanner: /usr/share/pykota/banner-page.sh 
     653 
    602654# How should enforcement be done for this printer ? 
    603655# 
  • 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