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

« back to all changes in this revision

Viewing changes to www/apps/tutorial/__init__.py

  • Committer: mattgiuca
  • Date: 2008-02-29 02:16:41 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:626
tutorial: More of the same (replace os.sep with '/').

Show diffs side-by-side

added added

removed removed

Lines of Context:
121
121
    # First normalise the path
122
122
    urlpath = os.path.normpath(req.path)
123
123
    # Now if it begins with ".." or separator, then it's illegal
124
 
    if urlpath.startswith("..") or urlpath.startswith(os.sep):
 
124
    if urlpath.startswith("..") or urlpath.startswith('/'):
125
125
        req.throw_error(req.HTTP_FORBIDDEN,
126
126
            "Invalid path.")
127
127
    filename = os.path.join(conf.subjects_base, urlpath)
141
141
def handle_toplevel_menu(req):
142
142
    # This is represented as a directory. Redirect and add a slash if it is
143
143
    # missing.
144
 
    if req.uri[-1] != os.sep:
 
144
    if req.uri[-1] != '/':
145
145
        req.throw_redirect(make_tutorial_path())
146
146
    req.write_html_head_foot = True
147
147
    req.write('<div id="ivle_padding">\n')
167
167
def handle_subject_menu(req, subject):
168
168
    # This is represented as a directory. Redirect and add a slash if it is
169
169
    # missing.
170
 
    if req.uri[-1] != os.sep:
 
170
    if req.uri[-1] != '/':
171
171
        req.throw_redirect(make_tutorial_path(subject))
172
172
    # Subject names must be valid identifiers
173
173
    if not is_valid_subjname(subject):
308
308
    # First normalise the path
309
309
    exercisesrc = os.path.normpath(exercisesrc)
310
310
    # Now if it begins with ".." or separator, then it's illegal
311
 
    if exercisesrc.startswith("..") or exercisesrc.startswith(os.sep):
 
311
    if exercisesrc.startswith("..") or exercisesrc.startswith('/'):
312
312
        exercisefile = None
313
313
    else:
314
314
        exercisefile = os.path.join(conf.exercises_base, exercisesrc)