Changeset 615 for tea4cups

Show
Ignore:
Timestamp:
03/31/05 00:05:34 (20 years ago)
Author:
jerome
Message:

job-billing is now available as $TEABILLING
Job's IPP message file is now available as $TEACONTROLFILE

Location:
tea4cups/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • tea4cups/trunk/NEWS

    r611 r615  
    2222Tea4CUPS News : 
    2323    
     24  * 2.10 :  
     25   
     26    - Makes the IPP message filename and the Job's billing code available. 
     27     
    2428  * 2.00 : 
    2529 
  • tea4cups/trunk/README

    r612 r615  
    6666        TEAOPTIONS : Options of the print job. 
    6767        TEAINPUTFILE : Print job's data file or empty when job read from stdin. 
     68        TEABILLING : Job's billing code (lp -o job-billing=SomeCode file.ps) 
     69        TEACONTROLFILE : Job's IPP message file (usually /var/spool/cups/c?????) 
    6870        TEASTATUS : Original CUPS backend's exit code : ONLY AVAILABLE FROM  
    6971                    posthooks, obviously. 
  • tea4cups/trunk/tea4cups

    r614 r615  
    3737from struct import unpack 
    3838 
    39 version = "2.01alpha1_unofficial" 
     39version = "2.10_unofficial" 
    4040 
    4141class TeeError(Exception): 
     
    415415        self.Directory = self.getPrintQueueOption(self.PrinterName, "directory") 
    416416        self.DataFile = os.path.join(self.Directory, "%s-%s-%s-%s" % (self.myname, self.PrinterName, self.UserName, self.JobId)) 
    417         self.ClientHost = self.extractJobOriginatingHostName() 
     417        (ippfilename, ippmessage) = self.parseIPPMessageFile() 
     418        self.ControlFile = ippfilename 
     419        self.ClientHost = ippmessage.get("job-originating-host-name") 
     420        self.JobBilling = ippmessage.get("job-billing") 
    418421             
    419422    def getCupsConfigDirectives(self, directives=[]) : 
     
    444447        return dirvalues        
    445448             
    446     def extractJobOriginatingHostName(self) :         
     449    def parseIPPMessageFile(self) :         
    447450        """Extracts the client's hostname or IP address from the CUPS message file for current job.""" 
    448451        cupsdconf = self.getCupsConfigDirectives(["RequestRoot"]) 
     
    467470                self.logDebug("Parsing of IPP message file %s ends." % ippmessagefile) 
    468471            ippdatafile.close() 
    469         return ippmessage.get("job-originating-host-name")     
     472        return (ippmessagefile, ippmessage) 
    470473                 
    471474    def exportAttributes(self) :     
     
    484487        os.environ["TEAOPTIONS"] = self.Options 
    485488        os.environ["TEAINPUTFILE"] = self.InputFile or "" 
     489        os.environ["TEABILLING"] = self.JobBilling or "" 
     490        os.environ["TEACONTROLFILE"] = self.ControlFile 
    486491         
    487492    def saveDatasAndCheckSum(self) : 
  • tea4cups/trunk/tea4cups.conf

    r612 r615  
    7474# TEACOPIES : Number of copies requested. 
    7575# TEAOPTIONS : Options of the print job. 
    76 # TEAINPUTFILE : Print job's data file or empty when job read from stdin. 
     76# TEAINPUTFILE : Job's data file or empty when job read from stdin. 
     77# TEABILLING : Job's billing code (lp -o job-billing=SomeCode file.ps) 
     78# TEACONTROLFILE : Job's IPP message file (usually /var/spool/cups/c?????) 
    7779# 
    7880# Your own commands will mostly be interested in TEADATAFILE which is 
    7981# the name of the file from which your commands may extract the final 
    80 # job's datas. 
     82# job's datas. Don't rely on TEAINPUTFILE, use TEADATAFILE instead 
     83# since the first one may be empty depending on your printer driver. 
    8184         
    8285# Now defines some default tees which will always be launched