Changeset 2405

Show
Ignore:
Timestamp:
08/26/05 14:14:40 (19 years ago)
Author:
jerome
Message:

Added support for the new 'directory' and 'keepfiles' directives.
Both will be used in the new cupspykota backend.

Location:
pykota/trunk
Files:
2 modified

Legend:

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

    r2392 r2405  
    353353# 
    354354# unknown_billingcode : create 
     355 
     356# Where should we store our (temporary) files when printing ? 
     357# if unset, defaults to a system directory dedicated to temporary 
     358# files and evaluated at runtime (see Python's documentation 
     359# for the tempfile.gettempdir() function). 
     360# This value can be set either globally or on a per printer basis 
     361# If both are defined, the printer option has priority. 
     362# directory : /tmp 
     363# directory : /var/spool/cups 
     364 
     365# Should we keep our work files on disk after printing ? 
     366# If unset, temporary files are deleted once the work is finished. 
     367# If set to yes, files are kept on disk in the 'directory'  
     368# named with the previous directive. 
     369# This value can be set either globally or on a per printer basis 
     370# If both are defined, the printer option has priority. 
     371# Default value is No, meaning temporary files are deleted 
     372# keepfiles : yes 
     373keepfiles : no 
     374 
    355375 
    356376# What is the accounting backend to use 
  • pykota/trunk/pykota/config.py

    r2385 r2405  
    2424 
    2525import os 
     26import tempfile 
    2627import ConfigParser 
    2728 
     
    431432        return self.isTrue(self.getGlobalOption("reject_unknown", ignore=1)) 
    432433         
     434    def getPrinterKeepFiles(self, printername) :           
     435        """Returns 1 if files must be kept on disk, else 0.""" 
     436        try :  
     437            return self.isTrue(self.getPrinterOption(printername, "keepfiles")) 
     438        except PyKotaConfigError :     
     439            return 0 
     440             
     441    def getPrinterDirectory(self, printername) :           
     442        """Returns the path to our working directory, else a directory suitable for temporary files.""" 
     443        try :  
     444            return self.getPrinterOption(printername, "directory").strip() 
     445        except PyKotaConfigError :     
     446            return tempfile.gettempdir() 
     447             
    433448    def getDenyDuplicates(self, printername) :           
    434449        """Returns 1 or a command if we want to deny duplicate jobs, else 0."""