Mercurial > p > roundup > code
annotate roundup/config.py @ 604:13719594278b config-0-4-0-branch
I've re-worked the config structure a little so it's simpler
(one less file) and added a unit test so we can be sure it's working.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 06 Feb 2002 07:11:13 +0000 |
| parents | fdee2ff82b40 |
| children |
| rev | line source |
|---|---|
|
604
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
1 '''Organise the configuration files for roundup installations. |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
2 |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
3 There's two configuration files of interest to any given roundup instance: |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
4 |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
5 roundup.rc: |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
6 This is the global configuration file. It specifies: |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
7 . default configuration variable values |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
8 . instance names and locations |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
9 |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
10 <instance home>/config.rc: |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
11 This defines the configuration overrides for the instance |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
12 |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
13 Config values are determined in order: |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
14 1. instance config application-specific section: |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
15 'MAIL GATEWAY' |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
16 'HTTP SERVER' |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
17 'CGI' |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
18 'ADMIN' |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
19 2. instance config 'DEFAULT' with some added vars: |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
20 'instance_home': the home dir |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
21 3. all the entries from the roundup.rc global '[DEFAULT]' |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
22 4. pre-set application defaults (in this file) |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
23 |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
24 Some variables will raise errors if an attempt is made to look them up |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
25 using the application defaults: |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
26 . mailhost |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
27 . mail_domain |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
28 . issue_tracker_email |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
29 . issue_tracker_web |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
30 . admin_email |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
31 |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
32 ''' |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
33 import sys, os, ConfigParser |
|
480
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
34 |
|
481
a261b0bbba43
Fixed a number of minor syntax issues & error handling.
Titus Brown <titus@users.sourceforge.net>
parents:
480
diff
changeset
|
35 class Error(Exception): |
|
a261b0bbba43
Fixed a number of minor syntax issues & error handling.
Titus Brown <titus@users.sourceforge.net>
parents:
480
diff
changeset
|
36 pass |
|
a261b0bbba43
Fixed a number of minor syntax issues & error handling.
Titus Brown <titus@users.sourceforge.net>
parents:
480
diff
changeset
|
37 |
|
482
fdee2ff82b40
Miscellaneous improvements
Titus Brown <titus@users.sourceforge.net>
parents:
481
diff
changeset
|
38 class UnknownInstanceLocation(Error): |
|
fdee2ff82b40
Miscellaneous improvements
Titus Brown <titus@users.sourceforge.net>
parents:
481
diff
changeset
|
39 pass |
|
fdee2ff82b40
Miscellaneous improvements
Titus Brown <titus@users.sourceforge.net>
parents:
481
diff
changeset
|
40 |
|
fdee2ff82b40
Miscellaneous improvements
Titus Brown <titus@users.sourceforge.net>
parents:
481
diff
changeset
|
41 class NoInstanceConfigFile(Error): |
|
fdee2ff82b40
Miscellaneous improvements
Titus Brown <titus@users.sourceforge.net>
parents:
481
diff
changeset
|
42 pass |
|
fdee2ff82b40
Miscellaneous improvements
Titus Brown <titus@users.sourceforge.net>
parents:
481
diff
changeset
|
43 |
|
480
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
44 def debug_mode(): |
|
604
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
45 """Returns the basic debug mode/level. |
|
480
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
46 """ |
|
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
47 return os.environ.get('ROUNDUP_DEBUG', 0) |
|
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
48 |
|
482
fdee2ff82b40
Miscellaneous improvements
Titus Brown <titus@users.sourceforge.net>
parents:
481
diff
changeset
|
49 def loadBaseConfig(): |
|
604
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
50 """Loads the base configuration for Roundup. |
|
480
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
51 """ |
|
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
52 |
|
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
53 |
|
604
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
54 # CTB: this is where to search for all overrides, including |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
55 # system-specific files, registry settings, etc. |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
56 # |
|
480
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
57 # For the moment, search for the config file in |
|
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
58 # |
|
604
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
59 # ${ROUNDUP_CONF}/roundup.rc |
|
480
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
60 # %(sys.prefix)s/share/roundup/roundup.rc, |
|
604
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
61 # |
|
480
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
62 filenames_to_check = [] # list of files to check: |
|
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
63 if os.environ.has_key('ROUNDUP_CONF'): |
|
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
64 filenames_to_check.append(os.environ['ROUNDUP_CONF']) |
|
604
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
65 filenames_to_check.append('%s/share/roundup/roundup.rc'%sys.prefix) |
|
480
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
66 |
|
604
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
67 # right, now try to get a config |
|
480
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
68 for filename in filenames_to_check: |
|
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
69 if os.path.exists(filename): |
|
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
70 break |
|
481
a261b0bbba43
Fixed a number of minor syntax issues & error handling.
Titus Brown <titus@users.sourceforge.net>
parents:
480
diff
changeset
|
71 else: |
|
a261b0bbba43
Fixed a number of minor syntax issues & error handling.
Titus Brown <titus@users.sourceforge.net>
parents:
480
diff
changeset
|
72 raise Error("could not find configuration file") |
|
480
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
73 |
|
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
74 if debug_mode(): |
|
481
a261b0bbba43
Fixed a number of minor syntax issues & error handling.
Titus Brown <titus@users.sourceforge.net>
parents:
480
diff
changeset
|
75 print 'Loaded configuration from "%s".'%(filename,) |
|
480
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
76 |
|
604
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
77 return BaseConfig(filename) |
|
480
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
78 |
|
481
a261b0bbba43
Fixed a number of minor syntax issues & error handling.
Titus Brown <titus@users.sourceforge.net>
parents:
480
diff
changeset
|
79 class BaseConfig: |
|
604
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
80 """A container for the installation-wide roundup configuration. |
|
480
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
81 """ |
|
604
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
82 def __init__(self, filename): |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
83 self.filename = filename |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
84 self.conf = ConfigParser.ConfigParser() |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
85 self.conf.read(filename) |
|
480
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
86 |
|
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
87 def get(self, group, attr): |
|
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
88 return self.conf.get(group, attr) |
|
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
89 |
|
604
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
90 def listInstances(self): |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
91 return filter(lambda x:x!='BASE', self.conf.sections()) |
|
480
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
92 |
|
604
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
93 def loadInstanceConfig(self, home): |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
94 # set up the defaults for the instance config |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
95 defaults = { |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
96 'instance_home': home, |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
97 'http_port': '80', |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
98 'database': '%(instance_home)s/db', |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
99 'templates': '%(instance_home)s/html', |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
100 'log': '%(instance_home)s/log', |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
101 'filter_position': 'bottom', |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
102 'anonymous_access': 'deny', |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
103 'anonymous_register': 'deny', |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
104 'messages_to_author': 'no', |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
105 'email_signature_position': 'bottom', |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
106 } |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
107 for option in self.conf.options('BASE'): |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
108 defaults[option] = self.conf.get('BASE', option, 1) |
|
480
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
109 |
|
604
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
110 # make the instance config |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
111 inst = InstanceConfig(defaults) |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
112 inst.read(os.path.join(home, 'config.rc')) |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
113 inst.validate() |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
114 return inst |
|
480
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
115 |
|
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
116 |
|
604
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
117 class InstanceConfig(ConfigParser.ConfigParser): |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
118 """A container for each per-instance configuration. |
|
480
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
119 """ |
|
604
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
120 def validate(self): |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
121 '''Make sure the config is complete |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
122 ''' |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
123 assert self.has_option('BASE', 'instance_name') |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
124 assert self.has_option('BASE', 'mailhost') |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
125 assert self.has_option('BASE', 'mail_domain') |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
126 assert self.has_option('BASE', 'issue_tracker_email') |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
127 assert self.has_option('BASE', 'issue_tracker_web') |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
128 assert self.has_option('BASE', 'admin_email') |
|
480
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
129 |
|
604
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
130 def getBase(self, name): |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
131 '''Convenience wrapper |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
132 ''' |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
133 return self.get('BASE', name) |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
134 |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
135 def getMailGW(self, name): |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
136 '''Look up a var for the mail gateway |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
137 ''' |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
138 return self.get('MAIL GATEWAY', name) |
|
480
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
139 |
|
604
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
140 def getHTTPServer(self, name): |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
141 '''Look up a var for the standalone HTTP server |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
142 ''' |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
143 return self.get('HTTP SERVER', name) |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
144 |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
145 def getCGI(self, name): |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
146 '''Look up a var for the cgi script |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
147 ''' |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
148 return self.get('CGI', name) |
|
480
a5cd27d33516
Initial ConfigParser implementation.
Titus Brown <titus@users.sourceforge.net>
parents:
diff
changeset
|
149 |
|
604
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
150 def getAdmin(self, name): |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
151 '''Look up a var for the admin script |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
152 ''' |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
153 return self.get('ADMIN', name) |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
154 |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
155 def get_default_database_dir(self): |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
156 '''Historical method to allow migration to using this new config |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
157 system... |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
158 ''' |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
159 return self.get('BASE', 'DATABASE') |
|
13719594278b
I've re-worked the config structure a little so it's simpler
Richard Jones <richard@users.sourceforge.net>
parents:
482
diff
changeset
|
160 |
