Changeset 574 for tea4cups/trunk/cupsoftee
- Timestamp:
- 03/11/05 23:14:35 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
tea4cups/trunk/cupsoftee
r573 r574 63 63 self.config = FakeConfig() 64 64 self.debug = 1 # no config, so force debug mode ! 65 66 def logDebug(self, message) : 67 """Logs something to debug output if debug is enabled.""" 68 if self.debug : 69 sys.stderr.write("DEBUG: %s\n" % message) 70 sys.stderr.flush() 65 71 72 def logInfo(self, message, level="info") : 73 """Logs a message to CUPS' error_log file.""" 74 sys.stderr.write("%s: %s\n" % (level.upper(), message)) 75 sys.stderr.flush() 76 66 77 def isTrue(self, option) : 67 78 """Returns 1 if option is set to true, else 0.""" … … 81 92 raise ConfigError, "Option %s not found in section global of %s" % (option, self.conffile) 82 93 83 def getSectionOption(self, sectionname, option) :94 def getSectionOption(self, printqueuename, option) : 84 95 """Returns an option from the printer section, or the global section, or raises a ConfigError.""" 85 96 globaloption = self.getGlobalOption(option, ignore=1) 86 97 try : 87 return self.config.get( sectionname, option, raw=1)98 return self.config.get(printqueuename, option, raw=1) 88 99 except (ConfigParser.NoSectionError, ConfigParser.NoOptionError) : 89 100 if globaloption is not None : 90 101 return globaloption 91 102 else : 92 raise ConfigError, "Option %s not found in section [%s] of %s" % (option, sectionname, self.conffile)103 raise ConfigError, "Option %s not found in section [%s] of %s" % (option, printqueuename, self.conffile) 93 104 94 def enumTeeBranches(self, sectionname) :105 def enumTeeBranches(self, printqueuename) : 95 106 """Returns the list of branches for a particular section's Tee.""" 96 107 try : … … 100 111 globalbranches = [] 101 112 try : 102 sectionbranches = [ (k, v) for (k, v) in self.config.items( sectionname) if k.startswith("tee_") ]113 sectionbranches = [ (k, v) for (k, v) in self.config.items(printqueuename) if k.startswith("tee_") ] 103 114 except ConfigParser.NoSectionError, msg : 104 115 self.printInfo("Invalid configuration file : %s" % msg, "error") … … 229 240 sys.argv[5], \ 230 241 backend) 231 232 def logDebug(self, message) :233 """Logs something to debug output if debug is enabled."""234 if self.debug :235 sys.stderr.write("DEBUG: %s\n" % message)236 sys.stderr.flush()237 238 def logInfo(self, message, level="info") :239 """Logs a message to CUPS' error_log file."""240 sys.stderr.write("%s: %s\n" % (level.upper(), message))241 sys.stderr.flush()242 242 243 243 if __name__ == "__main__" :