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

« back to all changes in this revision

Viewing changes to src/common/studpath.py

  • Committer: drtomc
  • Date: 2007-12-19 20:48:44 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:87
First hack at the python console.

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
def url_to_jailpaths(urlpath):
64
64
    """Given a URL path (part of a URL query string), returns a tuple of
65
65
        * the username of the student whose directory is being browsed
66
 
        * the absolute path where the jail will be located.
 
66
        * the path where the jail will be located relative to conf.student_dir
 
67
          (the jail directory relative to the system jails root).
67
68
        * the path of the file relative to the jail.
68
69
 
69
70
    urlpath: See urlpath in url_to_local.
70
71
 
71
72
    >>> url_to_jailpaths("joe/home/mydir/myfile")
72
 
    ("joe", "/home/informatics/jails/joe", "home/joe/home/mydir/myfile")
 
73
    ("joe", "joe", "home/joe/home/mydir/myfile")
73
74
 
74
75
    >>> url_to_jailpaths("")
75
76
    (None, None, None)
79
80
    (user, subpath) = util.split_path(urlpath)
80
81
    if user is None: return (None, None, None)
81
82
 
82
 
    jail = os.path.join(conf.student_dir, user)
83
83
    path = os.path.join('home', urlpath)
84
84
 
85
 
    return (user, jail, path)
 
85
    return (user, user, path)