-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
30 lines (25 loc) · 887 Bytes
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
import sys
import configparser
class Settings:
# Settings file for program
settings = configparser.ConfigParser()
def __init__(self):
Settings.settings.read(os.path.join(sys.path[0], 'settings.ini'))
def section(self, section):
dictionary = {}
options = Settings.settings.options(section)
for option in options:
try:
dictionary[option] = self.settings.get(section, option)
if dictionary[option] == -1:
print("skip: %s" % option)
except:
print("exception on %s!" % option)
dictionary[option] = None
return dictionary
def check_for_attribute(self, section, attribute):
if self.section(section)[attribute]: # if LoginPath is not blank
return True
else:
return False