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

« back to all changes in this revision

Viewing changes to www/apps/fileservice/__init__.py

  • Committer: William Grant
  • Date: 2009-01-13 01:36:15 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:1123
Merge setup-refactor branch. This completely breaks existing installations;
every path (both filesystem and Python) has changed. Do not upgrade without
knowing what you are doing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
 
32
32
import os.path
33
33
 
34
 
import conf
35
 
import fileservice_lib
36
 
import common
37
 
import common.interpret
38
 
import common.util
 
34
import ivle.conf
 
35
import ivle.fileservice_lib
 
36
import ivle.interpret
 
37
import ivle.util
39
38
 
40
39
# handle_with_trampoline controls the way in which fileservice_lib is invoked.
41
40
# If False, it will simply be called directly by this handler.
49
48
# permissions issues unless all user's files are owned by the web server user.
50
49
HANDLE_WITH_TRAMPOLINE = True
51
50
 
52
 
fileservice_path = "/opt/ivle/services/fileservice"   # Within jail
 
51
fileservice_path = os.path.join(ivle.conf.share_path, 'services/fileservice')
53
52
 
54
53
def handle(req):
55
54
    """Handler for the File Services application."""
56
55
    if len(req.path) == 0:
57
56
        # If no path specified, default to the user's home directory
58
 
        req.throw_redirect(common.util.make_path(os.path.join('fileservice',
 
57
        req.throw_redirect(ivle.util.make_path(os.path.join('fileservice',
59
58
                                                       req.user.login)))
60
59
    if not HANDLE_WITH_TRAMPOLINE:
61
 
        fileservice_lib.handle(req)
 
60
        ivle.fileservice_lib.handle(req)
62
61
    else:
63
 
        interp_object = common.interpret.interpreter_objects["cgi-python"]
64
 
        user_jail_dir = os.path.join(conf.jail_base, req.user.login)
65
 
        common.interpret.interpret_file(req, req.user.login, user_jail_dir,
 
62
        interp_object = ivle.interpret.interpreter_objects["cgi-python"]
 
63
        user_jail_dir = os.path.join(ivle.conf.jail_base, req.user.login)
 
64
        ivle.interpret.interpret_file(req, req.user.login, user_jail_dir,
66
65
            fileservice_path, interp_object, gentle=False)