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

« back to all changes in this revision

Viewing changes to ivle/interpret.py

  • Committer: Matt Giuca
  • Date: 2009-05-26 03:53:51 UTC
  • mfrom: (1273 trunk)
  • mto: This revision was merged to the branch mainline in revision 1322.
  • Revision ID: matt.giuca@gmail.com-20090526035351-caa8tftabtda77sq
MergeĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
# Runs a student script in a safe execution environment.
23
23
 
24
24
from ivle import studpath
25
 
from ivle.util import IVLEError, IVLEJailError
 
25
from ivle.util import IVLEError, IVLEJailError, split_path
26
26
import ivle.conf
27
27
 
28
28
import functools
404
404
    if script_path and script_path.startswith('/home'):
405
405
        normscript = os.path.normpath(script_path)
406
406
 
407
 
        uri_into_jail = studpath.url_to_jailpaths(os.path.normpath(req.path))[2]
 
407
        uri_into_jail = studpath.to_home_path(os.path.normpath(req.path))
408
408
 
409
409
        # PATH_INFO is wrong because the script doesn't physically exist.
410
410
        env['PATH_INFO'] = uri_into_jail[len(normscript):]
416
416
    env['SERVER_SOFTWARE'] = "IVLE/" + str(ivle.conf.ivle_version)
417
417
 
418
418
    # Additional environment variables
419
 
    username = studpath.url_to_jailpaths(req.path)[0]
 
419
    username = split_path(req.path)[0]
420
420
    env['HOME'] = os.path.join('/home', username)
421
421
 
422
422
class ExecutionError(Exception):