Last change
on this file since 7196e71 was
05b1088,
checked in by Alvaro Neira Ayuso <alvaroneay@…>, 5 years ago
|
Include License header
|
-
Property mode set to
100644
|
File size:
747 bytes
|
Line | |
---|
1 | # |
---|
2 | # Copyright (C) 2020 Soleta Networks <info@soleta.eu> |
---|
3 | # |
---|
4 | # This program is free software: you can redistribute it and/or modify it under |
---|
5 | # the terms of the GNU Affero General Public License as published by the |
---|
6 | # Free Software Foundation, version 3. |
---|
7 | # |
---|
8 | |
---|
9 | import configparser |
---|
10 | |
---|
11 | class ogConfig: |
---|
12 | def __init__(self): |
---|
13 | self.parser = configparser.ConfigParser() |
---|
14 | |
---|
15 | def parserFile(self, path): |
---|
16 | self.parser.read(path) |
---|
17 | if len(self.parser.sections()) == 0: |
---|
18 | return False |
---|
19 | |
---|
20 | return True |
---|
21 | |
---|
22 | def getSections(self): |
---|
23 | return self.parser.sections() |
---|
24 | |
---|
25 | def getContainsSection(self, section): |
---|
26 | return section in self.parser |
---|
27 | |
---|
28 | def getValueSection(self, section, key): |
---|
29 | if (not self.getContainsSection(section)): |
---|
30 | return '' |
---|
31 | |
---|
32 | return self.parser[section][key] |
---|
Note: See
TracBrowser
for help on using the repository browser.