Show
Ignore:
Timestamp:
03/13/05 11:51:06 (19 years ago)
Author:
jerome
Message:

First working version

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • tea4cups/trunk/tea4cups

    r577 r579  
    110110            globalbranches = [ (k, v) for (k, v) in self.config.items("global") if k.startswith("tee_") ] 
    111111        except ConfigParser.NoSectionError, msg :     
    112             self.printInfo("Invalid configuration file : %s" % msg, "error") 
    113             globalbranches = [] 
     112            raise ConfigError, "Invalid configuration file : %s" % msg 
    114113        try : 
    115114            sectionbranches = [ (k, v) for (k, v) in self.config.items(printqueuename) if k.startswith("tee_") ] 
    116115        except ConfigParser.NoSectionError, msg :     
    117             self.printInfo("Invalid configuration file : %s" % msg, "error") 
     116            self.logInfo("No section for print queue %s : " % (printqueuename, msg), "info") 
    118117            sectionbranches = [] 
    119118        branches = {} 
     
    241240        os.environ["TEADIRECTORY"] = self.Directory 
    242241        os.environ["TEADATAFILE"] = self.DataFile 
    243         os.environ["TEAJOBSIZE"] = self.JobSize 
     242        os.environ["TEAJOBSIZE"] = str(self.JobSize) 
    244243        os.environ["TEAMD5SUM"] = self.JobMD5Sum 
    245244        os.environ["TEAJOBID"] = self.JobId 
     
    276275        outfile.close() 
    277276        if mustclose :     
    278             self.infile.close() 
     277            infile.close() 
    279278        self.JobSize = sizeread     
    280279        self.JobMD5Sum = checksum.hexdigest() 
     
    286285        if not self.isTrue(self.getPrintQueueOption(self.PrinterName, "keepfiles", ignore=1)) : 
    287286            os.remove(self.DataFile) 
     287             
     288    def runBranches(self) :          
     289        """Launches each tee defined for the current print queue.""" 
     290        branches = self.enumTeeBranches(self.PrinterName) 
     291        for (branch, command) in branches.items() : 
     292            self.logDebug("Launching %s : %s" % (branch, command)) 
     293            os.system(command) 
    288294         
    289295if __name__ == "__main__" :     
     
    301307        wrapper.saveDatasAndCheckSum() 
    302308        wrapper.exportAttributes() 
     309        retcode = wrapper.runBranches() 
    303310        wrapper.cleanUp() 
    304         sys.stderr.write("ERROR: Not Yet !\n") 
    305         sys.exit(1) 
     311        sys.exit(retcode)