1
# IVLE - Informatics Virtual Learning Environment
2
# Copyright (C) 2007-2009 The University of Melbourne
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
# Author: Matt Giuca, Will Grant
21
Temporary emulation layer for the old-style conf.py configuration file.
22
Loads the IVLE config file and provides all of the legacy config variables.
24
May raise a RuntimeError on import if it cannot find the config file.
35
conf = ivle.config.Config()
36
except ivle.config.ConfigError, e:
37
raise ImportError(str(e))
39
# This dict maps legacy config option names to new config option paths
40
# ('section/option_name')
42
'root_dir': 'urls/root',
43
'prefix': 'paths/prefix',
44
'data_path': 'paths/data',
45
'log_path': 'paths/logs',
46
'python_site_packages_override': 'paths/site_packages',
47
'public_host': 'urls/public_host',
48
'allowed_uids': 'os/allowed_uids',
49
'db_host': 'database/host',
50
'db_port': 'database/port',
51
'db_dbname': 'database/name',
52
'db_forumdbname': 'plugins/forum/dbname',
53
'db_user': 'database/username',
54
'db_password': 'database/password',
55
'auth_modules': 'auth/modules',
56
'ldap_url': 'auth/ldap_url',
57
'ldap_format_string': 'auth/ldap_format_string',
58
'subject_pulldown_modules': 'auth/subject_pulldown_modules',
59
'svn_addr': 'urls/svn_addr',
60
'usrmgt_host': 'usrmgt/host',
61
'usrmgt_port': 'usrmgt/port',
62
'usrmgt_magic': 'usrmgt/magic',
63
'forum_secret': 'plugins/forum/secret',
66
for legacyopt, newopt_path in CONFIG_OPTIONS.iteritems():
67
# Iterate over each segment of the path, and find the value in conf file
70
for seg in newopt_path.split('/'):
72
globals()[legacyopt] = value
74
globals()[legacyopt] = None
76
# XXX Munge some nice shiny new-style values into horrible old-style values
77
# IRONY: These have just been split from commas. We need to re-join it so that
78
# pulldown_subj and auth_modules can re-split them.
79
subject_pulldown_modules = ','.join(subject_pulldown_modules)
80
auth_modules = ','.join(auth_modules)
82
# XXX Convert db_port and usrmgt_port to int.
84
db_port = int(db_port)
85
usrmgt_port = int(usrmgt_port)
87
# Additional auto-generated config options
89
# Path where architecture-dependent data (including non-user-executable
90
# binaries) is installed.
91
lib_path = os.path.join(prefix, 'lib/ivle')
93
# Path where arch-independent data is installed.
94
share_path = os.path.join(prefix, 'share/ivle')
96
# Path where user-executable binaries are installed.
97
bin_path = os.path.join(prefix, 'bin')
99
# 'site-packages' directory in Python, where Python libraries are to be
101
if python_site_packages_override is None:
102
PYTHON_VERSION = sys.version[0:3] # eg. "2.5"
103
python_site_packages = os.path.join(prefix,
104
'lib/python%s/site-packages' % PYTHON_VERSION)
106
python_site_packages = python_site_packages_override
108
# In the local file system, where the student/user jails will be mounted.
109
# Only a single copy of the jail's system components will be stored here -
110
# all user jails will be virtually mounted here.
111
jail_base = os.path.join(data_path, 'jailmounts')
113
# In the local file system, where are the student/user file spaces located.
114
# The user jails are expected to be located immediately in subdirectories of
115
# this location. Note that no complete jails reside here - only user
117
jail_src_base = os.path.join(data_path, 'jails')
119
# In the local file system, where the template system jail will be stored.
120
jail_system = os.path.join(jail_src_base, '__base__')
122
# In the local file system, where the template system jail will be stored.
123
jail_system_build = os.path.join(jail_src_base, '__base_build__')
125
# In the local file system, where the subject content files are located.
126
# (The 'subjects' and 'exercises' directories).
127
content_path = os.path.join(data_path, 'content')
129
# In the local file system, where are the per-subject file spaces located.
130
# The individual subject directories are expected to be located immediately
131
# in subdirectories of this location.
132
subjects_base = os.path.join(content_path, 'subjects')
134
# In the local file system, where are the subject-independent exercise sheet
135
# file spaces located.
136
exercises_base = os.path.join(content_path, 'exercises')
138
# In the local file system, where the system notices are stored (such as terms
139
# of service and MOTD).
140
notices_path = os.path.join(data_path, 'notices')
142
# In the local file system, where is the Terms of Service document located.
143
tos_path = os.path.join(notices_path, 'tos.html')
145
# In the local file system, where is the Message of the Day document
146
# located. This is an HTML file (just the body fragment), which will
147
# be displayed on the login page. It is optional.
148
motd_path = os.path.join(notices_path, 'motd.html')
150
# The location of all the subversion config and repositories.
151
svn_path = os.path.join(data_path, 'svn')
153
# The location of the subversion configuration file used by
154
# apache to host the user repositories.
155
svn_conf = os.path.join(svn_path, 'svn.conf')
157
# The location of the subversion configuration file used by
158
# apache to host the user repositories.
159
svn_group_conf = os.path.join(svn_path, 'svn-group.conf')
161
# The root directory for the subversion repositories.
162
svn_repo_path = os.path.join(svn_path, 'repositories')
164
# The location of the password file used to authenticate users
165
# of the subversion repository from the ivle server.
166
svn_auth_ivle = os.path.join(svn_path, 'ivle.auth')