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

« back to all changes in this revision

Viewing changes to lib/common/studpath.py

  • Committer: mattgiuca
  • Date: 2008-03-15 14:19:29 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:710
Tutorial: The tutorial system now presents a table of contents at the top.
    (This is supposed to be a side bar, but the CSS stylings was too gnarly
    for me tonight!)
    The TOC presents all h1,h2,h3 and exercise nodes in a list.
    The exercises are presented with their green/grey balls to indicate
    completion.
The tutorial JavaScript automatically updates the balls in the
table-of-contents to green if they pass, dynamically.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
            found within the student directories.
43
43
 
44
44
    urlpath: Part of the URL, but only the part *after* the application. For
45
 
    instance, given the URL "/ivle/browse/joe/home/mydir/myfile", urlpath will
46
 
    be just "joe/home/mydir/myfile". The expected result is something like
47
 
    ("joe", "/home/informatics/jails/joe/home/joe/home/mydir/myfile").
 
45
    instance, given the URL "/ivle/browse/joe/mydir/myfile", urlpath will
 
46
    be just "joe/mydir/myfile". The expected result is something like
 
47
    ("joe", "/home/informatics/jails/joe/home/joe/mydir/myfile").
48
48
    Note that the actual location is not guaranteed by this interface (this
49
49
    function serves as a single point of control as to how URLs map onto
50
50
    student directories).
80
80
 
81
81
    urlpath: See urlpath in url_to_local.
82
82
 
83
 
    >>> url_to_jailpaths("joe/home/mydir/myfile")
84
 
    ("joe", "/home/informatics/jails/joe", "home/joe/home/mydir/myfile")
 
83
    >>> url_to_jailpaths("joe/mydir/myfile")
 
84
    ("joe", "/home/informatics/jails/joe", "home/joe/mydir/myfile")
85
85
 
86
86
    >>> url_to_jailpaths("")
87
87
    (None, None, None)
114
114
    return len(props) > 0
115
115
 
116
116
def authorize(req):
117
 
    """Given a request, checks whether req.username is allowed to
 
117
    """Given a request, checks whether req.user is allowed to
118
118
    access req.path. Returns None on authorization success. Raises
119
119
    HTTP_FORBIDDEN on failure.
120
120
 
129
129
        req.throw_error(req.HTTP_FORBIDDEN)
130
130
 
131
131
    (owner, _) = util.split_path(urlpath)
132
 
    if req.username != owner:
 
132
    if req.user.login != owner:
133
133
        req.throw_error(req.HTTP_FORBIDDEN)
134
134
 
135
135
def authorize_public(req):