source: orange-bioinformatics/obiKEGG2/conf.py @ 1603:7a78a7302c20

Revision 1603:7a78a7302c20, 852 bytes checked in by Ales Erjavec <ales.erjavec@…>, 2 years ago (diff)

Configurable cache invalidation.

Line 
1"""
2obiKEGG2 configuration
3
4mostly just caching settings
5
6"""
7
8import os
9import ConfigParser
10from StringIO import StringIO
11from Orange.utils import serverfiles
12kegg_dir = serverfiles.localpath("KEGG2")
13
14default = """
15[cache]
16# path = %(home)s/.obiKEGG/
17path = %(kegg_dir)s/
18store = sqlite3
19invalidate = weekly
20
21[service]
22transport = urllib2
23# transport = requests
24
25"""
26
27# Orange kegg files dir
28
29env = dict(os.environ)
30env["kegg_dir"] = kegg_dir
31
32parser = ConfigParser.ConfigParser(env)
33
34
35parser.readfp(StringIO(default), "default")
36
37# TODO: global settings rc file
38parser.read([os.path.expanduser("~/.obiKEGG/rc.cfg")])
39
40params = {}
41
42_ALL_PARAMS = \
43    ["cache.path",
44     "cache.store",
45     "cache.invalidate",
46     "service.transport"
47     ]
48for p in _ALL_PARAMS:
49    section, option = p.split(".")
50    params[p] = parser.get(section, option)
51   
Note: See TracBrowser for help on using the repository browser.