-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathConfigParser.py
36 lines (28 loc) · 1.19 KB
/
ConfigParser.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
31
32
33
34
from FileCacheManager import FileCacheManager
class ConfigParser:
'''
Class that contains functions to constuct the config map from the config file
'''
configContent={}
def __init__(self,fileName):
'''
constructor that generates the map of the config file
@param fileName: file containing config
@type fileName: string
'''
configFile=FileCacheManager(fileName)
tempConfigContent={}
#Now configFile.filecontent ccontains the file content
for line in configFile.filecontent:
lineSplit=line.split(":")
if(len(lineSplit)==1):
if("UpdateAndSend" in tempConfigContent):
tempConfigContent["UpdateAndSend"]=tempConfigContent["UpdateAndSend"]+"\n"+lineSplit[0]
else:
tempConfigContent["UpdateAndSend"]=lineSplit[0]
else:
tempConfigContent[lineSplit[0]]=lineSplit[1]
for k,v in tempConfigContent.iteritems():
newk=k.strip()
newv=v.strip()
self.configContent[newk]=newv