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

« back to all changes in this revision

Viewing changes to ivle/studpath.py

  • Committer: William Grant
  • Date: 2009-05-26 02:31:42 UTC
  • Revision ID: grantw@unimelb.edu.au-20090526023142-ddun761n1av5o8ka
Factor out the in-jail path bits of url_to_jailpaths.

Show diffs side-by-side

added added

removed removed

Lines of Context:
103
103
    if user is None: return (None, None, None)
104
104
 
105
105
    jail = os.path.join(ivle.conf.jail_base, user)
106
 
    path = os.path.join('/home', urlpath)
 
106
    path = url_path_to_jail_path(urlpath)
107
107
 
108
108
    return (user, jail, path)
109
109
 
 
110
def url_path_to_jail_path(urlpath):
 
111
    """Given a URL path (eg. joe/foo/bar/baz), returns a path within the jail.
 
112
 
 
113
    >>> url_path_to_jail_path('joe/foo/bar/baz')
 
114
    '/home/joe/foo/bar/baz'
 
115
    """
 
116
    return os.path.join('/home', urlpath)
 
117
 
110
118
def svnpublished(path):
111
119
    """Given a path on the LOCAL file system, determines whether the path has
112
120
    its "ivle:published" property active (in subversion). Returns True