94 | | def getSectionNames(self) : |
95 | | """Returns the list of sections, i.e. all sections names minus 'global'.""" |
96 | | return [pname for pname in self.config.sections() if pname != "global"] |
| 94 | def enumTeeBranches(self, sectionname) : |
| 95 | """Returns the list of branches for a particular section's Tee.""" |
| 96 | try : |
| 97 | globalbranches = [ (k, v) for (k, v) in self.config.items("global") if k.startswith("tee_") ] |
| 98 | except ConfigParser.NoSectionError, msg : |
| 99 | self.printInfo("Invalid configuration file : %s" % msg, "error") |
| 100 | globalbranches = [] |
| 101 | try : |
| 102 | sectionbranches = [ (k, v) for (k, v) in self.config.items(sectionname) if k.startswith("tee_") ] |
| 103 | except ConfigParser.NoSectionError, msg : |
| 104 | self.printInfo("Invalid configuration file : %s" % msg, "error") |
| 105 | sectionbranches = [] |
| 106 | branches = {} |
| 107 | for (k, v) in globalbranches : |
| 108 | value = v.strip() |
| 109 | if value : |
| 110 | branches[k] = value |
| 111 | for (k, v) in sectionbranches : |
| 112 | value = v.strip() |
| 113 | if value : |
| 114 | branches[k] = value # overwrite any global option or set a new value |
| 115 | else : |
| 116 | del branches[k] # empty value disables a global option |
| 117 | return branches |