~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/conf/conf.py

  • Committer: William Grant
  • Date: 2010-02-25 07:34:50 UTC
  • Revision ID: grantw@unimelb.edu.au-20100225073450-zcl8ev5hlyhbszeu
Activate the Storm C extensions if possible. Moar speed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# IVLE - Informatics Virtual Learning Environment
 
2
# Copyright (C) 2007-2009 The University of Melbourne
 
3
#
 
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.
 
8
#
 
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.
 
13
#
 
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
 
17
 
 
18
# Author: Matt Giuca, Will Grant
 
19
 
 
20
"""
 
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.
 
23
 
 
24
May raise a RuntimeError on import if it cannot find the config file.
 
25
"""
 
26
 
 
27
import os
 
28
import sys
 
29
 
 
30
import configobj
 
31
 
 
32
import ivle.config
 
33
 
 
34
try:
 
35
    conf = ivle.config.Config(plugins=False)
 
36
except ivle.config.ConfigError, e:
 
37
    raise ImportError(str(e))
 
38
 
 
39
# This dict maps legacy config option names to new config option paths
 
40
# ('section/option_name')
 
41
CONFIG_OPTIONS = {
 
42
    'root_dir': 'urls/root',
 
43
    'prefix': 'paths/prefix',
 
44
    'data_path': 'paths/data',
 
45
    'log_path': 'paths/logs',
 
46
    'public_host': 'urls/public_host',
 
47
    'db_host': 'database/host',
 
48
    'db_port': 'database/port',
 
49
    'db_dbname': 'database/name',
 
50
    'db_user': 'database/username',
 
51
    'db_password': 'database/password',
 
52
    'auth_modules': 'auth/modules',
 
53
    'ldap_url': 'auth/ldap_url',
 
54
    'ldap_format_string': 'auth/ldap_format_string',
 
55
    'subject_pulldown_modules': 'auth/subject_pulldown_modules',
 
56
    'svn_addr': 'urls/svn_addr',
 
57
    'usrmgt_host': 'usrmgt/host',
 
58
    'usrmgt_port': 'usrmgt/port',
 
59
    'usrmgt_magic': 'usrmgt/magic',
 
60
 
 
61
    # These two are only relevant inside the jail.
 
62
    'login': 'user_info/login',
 
63
    'svn_pass': 'user_info/svn_pass',
 
64
}
 
65
 
 
66
for legacyopt, newopt_path in CONFIG_OPTIONS.iteritems():
 
67
    # Iterate over each segment of the path, and find the value in conf file
 
68
    try:
 
69
        value = conf
 
70
        for seg in newopt_path.split('/'):
 
71
            value = value[seg]
 
72
        globals()[legacyopt] = value
 
73
    except KeyError:
 
74
        globals()[legacyopt] = None
 
75
 
 
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)
 
81
 
 
82
# Additional auto-generated config options
 
83
 
 
84
# Path where architecture-dependent data (including non-user-executable
 
85
# binaries) is installed.
 
86
lib_path = os.path.join(prefix, 'lib/ivle')
 
87
 
 
88
# Path where arch-independent data is installed.
 
89
share_path = os.path.join(prefix, 'share/ivle')
 
90
 
 
91
# Path where user-executable binaries are installed.
 
92
bin_path = os.path.join(prefix, 'bin')
 
93
 
 
94
# In the local file system, where the student/user jails will be mounted.
 
95
# Only a single copy of the jail's system components will be stored here -
 
96
# all user jails will be virtually mounted here.
 
97
# XXX: Some jail code calls ivle.studpath.url_to_{local,jailpaths}, both
 
98
#      of which use jail_base. Note that they don't use the bits of the
 
99
#      return value that depend on jail_base, so it can be any string inside
 
100
#      the jail. The value computed here may be meaningless inside the jail,
 
101
#      but that's OK for now.
 
102
jail_base = os.path.join(data_path, 'jailmounts')
 
103
 
 
104
# In the local file system, where are the student/user file spaces located.
 
105
# The user jails are expected to be located immediately in subdirectories of
 
106
# this location. Note that no complete jails reside here - only user
 
107
# modifications.
 
108
jail_src_base = os.path.join(data_path, 'jails')
 
109
 
 
110
# In the local file system, where the template system jail will be stored.
 
111
jail_system = os.path.join(jail_src_base, '__base__')
 
112
 
 
113
# In the local file system, where the template system jail will be stored.
 
114
jail_system_build = os.path.join(jail_src_base, '__base_build__')
 
115
 
 
116
# In the local file system, where the subject content files are located.
 
117
# (The 'subjects' and 'exercises' directories).
 
118
content_path = os.path.join(data_path, 'content')
 
119
 
 
120
# In the local file system, where the system notices are stored (such as terms
 
121
# of service and MOTD).
 
122
notices_path = os.path.join(data_path, 'notices')
 
123
 
 
124
# In the local file system, where is the Terms of Service document located.
 
125
tos_path = os.path.join(notices_path, 'tos.html')
 
126
 
 
127
# In the local file system, where is the Message of the Day document
 
128
# located. This is an HTML file (just the body fragment), which will
 
129
# be displayed on the login page. It is optional.
 
130
motd_path = os.path.join(notices_path, 'motd.html')
 
131
 
 
132
# The location of all the subversion config and repositories.
 
133
svn_path = os.path.join(data_path, 'svn')
 
134
 
 
135
# The location of the subversion configuration file used by
 
136
# apache to host the user repositories.
 
137
svn_conf = os.path.join(svn_path, 'svn.conf')
 
138
 
 
139
# The location of the subversion configuration file used by
 
140
# apache to host the user repositories.
 
141
svn_group_conf = os.path.join(svn_path, 'svn-group.conf')
 
142
 
 
143
# The root directory for the subversion repositories.
 
144
svn_repo_path = os.path.join(svn_path, 'repositories')
 
145
 
 
146
# The location of the password file used to authenticate users
 
147
# of the subversion repository from the ivle server.
 
148
svn_auth_ivle = os.path.join(svn_path, 'ivle.auth')