config file extended by categories, clients, references
This commit is contained in:
21
timeTrack.py
21
timeTrack.py
@@ -23,8 +23,11 @@ class TimeTrack:
|
||||
self.USERID = 0
|
||||
self.USERNAME = ''
|
||||
self.OLDEVENT = 2
|
||||
self.CLIENTS = False
|
||||
self.CATEGORIES = False
|
||||
self.REFERENCES = False
|
||||
self.LOGFILE = 'timetrack.log'
|
||||
self.DBCON = sqlite3.connect(self.DATABASE, detect_types=sqlite3.PARSE_DECLTYPES | sqlite3.PARSE_COLNAMES)
|
||||
self.DBCON = sqlite3.connect(self.DATABASE, detect_types=sqlite3.PARSE_DECLTYPES | sqlite3.PARSE_COLNAMES)
|
||||
logging.basicConfig(
|
||||
filename=self.LOGFILE,
|
||||
level=logging.DEBUG,
|
||||
@@ -61,17 +64,23 @@ class TimeTrack:
|
||||
quit()
|
||||
else:
|
||||
logging.info('Config file was loaded successfully')
|
||||
self.USERID = data['user']
|
||||
self.OLDEVENT = data['oldevent']
|
||||
logging.debug('UserID {} was used'.format(data['user']))
|
||||
self.USERID = data['userid']
|
||||
self.OLDEVENT = data['oldevent']
|
||||
self.CLIENTS = data['clients']
|
||||
self.CATEGORIES = data['categories']
|
||||
self.REFERENCES = data['references']
|
||||
logging.debug('UserID {} was used'.format(data['userid']))
|
||||
self.set_user()
|
||||
|
||||
else:
|
||||
logging.warning('Config file not found')
|
||||
config = {
|
||||
'default' : 'interactive',
|
||||
'user' : 1,
|
||||
'oldevent' : 2
|
||||
'userid' : 1,
|
||||
'oldevent' : 2,
|
||||
'clients' : False,
|
||||
'categories' : False,
|
||||
'references' : False
|
||||
}
|
||||
with open(self.CONFIG, "w") as outfile:
|
||||
json.dump(config, outfile, indent=4, sort_keys=True)
|
||||
|
||||
Reference in New Issue
Block a user