blob: 02556af298a172fb6d145e3a909245a837fcd318 (
plain)
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
35
|
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import codecs
def getTemplate():
return open(getTemplateName()).read()
def getTemplateName():
return loadConfiguration()["SILPA_TEMPLATE"]
def getCopyrightInfo():
return loadConfiguration()["SILPA_SITE_COPYRIGHT"]
def getModulesList():
conf_dict=loadConfiguration()
action_dict={}
for item in conf_dict :
if(item.startswith("SILPA_ACTION.")):
action_dict[item.replace("SILPA_ACTION.","")]=conf_dict[item]
return action_dict
def loadConfiguration():
conf_dict={}
conffile = codecs. open("silpa.conf",encoding='utf-8', errors='ignore')
while 1:
text = unicode( conffile.readline())
if text == "":
break
line = text.split("#")[0].strip()
if(line == ""):
continue
try:
lhs = line.split("=") [ 0 ]
rhs = line.split("=") [ 1 ]
conf_dict[lhs]=rhs
except:
pass
return conf_dict
if __name__ == '__main__':
print getModulesList()
|