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

« back to all changes in this revision

Viewing changes to services/interpretservice

  • Committer: chadnickbok
  • Date: 2009-01-13 05:33:58 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:1108
Updated the settings page to require the old password
when updating the password. Note that this field
is not shown when using ldap authentication

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
import urlparse
31
31
import subprocess
32
32
 
33
 
from ivle import (cgirequest, studpath)
34
 
import ivle.conf
35
 
import ivle.conf.mimetypes
36
 
import ivle.conf.app
37
 
import ivle.conf.app.server
 
33
from common import (cgirequest, studpath)
 
34
import conf
 
35
import conf.mimetypes, conf.app, conf.app.server
38
36
 
39
 
# XXX: using dirname because we don't have path config in the jailconf.
40
 
serveservice_path = os.path.join(os.path.dirname(__file__), 'serveservice')
 
37
serveservice_path = "/opt/ivle/services/serveservice"
41
38
 
42
39
def determine_file_type(filename):
43
40
    filetype = mimetypes.guess_type(filename)[0]
44
41
    if filetype is None:
45
 
         filetype = ivle.conf.mimetypes.default_mimetype
 
42
         filetype = conf.mimetypes.default_mimetype
46
43
    return filetype
47
44
 
48
45
req = cgirequest.CGIRequest()
76
73
 
77
74
    # We now have a file that exists, but is it something that we're allowed
78
75
    # to execute? If not, we should 404 anyway.
79
 
    if determine_file_type(filename) not in ivle.conf.app.server.interpreters:
 
76
    if determine_file_type(filename) not in conf.app.server.interpreters:
80
77
        req.throw_error(req.HTTP_NOT_FOUND,
81
78
            "The specified file (%s) does not exist." % urlpath)
82
79
 
114
111
    # the world at large. Directory contents are private).
115
112
    req.throw_error(req.HTTP_FORBIDDEN,
116
113
        "The path specified is a directory.")
117
 
elif determine_file_type(filename) in ivle.conf.app.server.interpreters:
 
114
elif determine_file_type(filename) in conf.app.server.interpreters:
118
115
    # We'll save on a fork and execute in this python process
119
116
    # Let exceptions blow up normally again
120
117
    sys.excepthook = sys.__excepthook__
124
121
else:
125
122
    # Otherwise, use the blacklist/whitelist to see if this file should be
126
123
    # served or disallowed
127
 
    if (ivle.conf.app.server.blacklist_served_filetypes and \
 
124
    if (conf.app.server.blacklist_served_filetypes and \
128
125
            determine_file_type(filename) in \
129
 
            ivle.conf.app.server.served_filetypes_blacklist) or \
130
 
        (ivle.conf.app.server.served_filetypes_whitelist and \
 
126
            conf.app.server.served_filetypes_blacklist) or \
 
127
        (conf.app.server.served_filetypes_whitelist and \
131
128
            determine_file_type(filename) not in \
132
 
            ivle.conf.app.server.served_filetypes_whitelist):
 
129
            conf.app.server.served_filetypes_whitelist):
133
130
        req.throw_error(req.HTTP_FORBIDDEN,
134
131
            "Files of this type are not allowed to be served.")
135
132