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

« back to all changes in this revision

Viewing changes to www/common/studpath.py

  • Committer: mattgiuca
  • Date: 2007-12-20 05:25:03 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:103
Fix to Makefile.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
 
45
45
    Returns (None, None) if the path is empty.
46
46
 
47
 
    See also: conf.jail_base
 
47
    See also: conf.student_dir
48
48
    """
49
 
    # First normalise the path
50
 
    urlpath = os.path.normpath(urlpath)
51
 
    # Now if it begins with ".." or separator, then it's illegal
52
 
    if urlpath.startswith("..") or urlpath.startswith(os.sep):
53
 
        return (None, None)
54
49
    # Note: User can be a group name. There is absolutely no difference in our
55
50
    # current directory scheme.
56
51
    (user, subpath) = util.split_path(urlpath)
61
56
    # accordance with our directory scheme.
62
57
    # (The first time is the name of the jail, the second is the user's home
63
58
    # directory within the jail).
64
 
    path = os.path.join(conf.jail_base, user, 'home', urlpath)
 
59
    path = os.path.join(conf.student_dir, user, 'home', urlpath)
65
60
 
66
61
    return (user, path)
67
62
 
79
74
    >>> url_to_jailpaths("")
80
75
    (None, None, None)
81
76
    """
82
 
    # First normalise the path
83
 
    urlpath = os.path.normpath(urlpath)
84
 
    # Now if it begins with ".." then it's illegal
85
 
    if urlpath.startswith(".."):
86
 
        return (None, None, None)
87
77
    # Note: User can be a group name. There is absolutely no difference in our
88
78
    # current directory scheme.
89
79
    (user, subpath) = util.split_path(urlpath)
90
80
    if user is None: return (None, None, None)
91
81
 
92
 
    jail = os.path.join(conf.jail_base, user)
 
82
    jail = os.path.join(conf.student_dir, user)
93
83
    path = os.path.join('home', urlpath)
94
84
 
95
85
    return (user, jail, path)