Last change
on this file since b9c33f2 was
29fe301,
checked in by Alvaro Neira Ayuso <alvaroneay@…>, 5 years ago
|
Create new ogClient
This commit init the new ogClient. The new ogClient has support for configuring
and for connecting with the ogAdminServer.
|
-
Property mode set to
100644
|
File size:
494 bytes
|
Rev | Line | |
---|
[29fe301] | 1 | import configparser |
---|
| 2 | |
---|
| 3 | class ogConfig: |
---|
| 4 | def __init__(self): |
---|
| 5 | self.parser = configparser.ConfigParser() |
---|
| 6 | |
---|
| 7 | def parserFile(self, path): |
---|
| 8 | self.parser.read(path) |
---|
| 9 | if len(self.parser.sections()) == 0: |
---|
| 10 | return False |
---|
| 11 | |
---|
| 12 | return True |
---|
| 13 | |
---|
| 14 | def getSections(self): |
---|
| 15 | return self.parser.sections() |
---|
| 16 | |
---|
| 17 | def getContainsSection(self, section): |
---|
| 18 | return section in self.parser |
---|
| 19 | |
---|
| 20 | def getValueSection(self, section, key): |
---|
| 21 | if (not self.getContainsSection(section)): |
---|
| 22 | return '' |
---|
| 23 | |
---|
| 24 | return self.parser[section][key] |
---|
Note: See
TracBrowser
for help on using the repository browser.