~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-01-25 00:53:12 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:298
tutorial: Problem files are now given relative to the subjects base directory,
    not the directory for this subject. This allows problem files to be shared
    across subjects and offerings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
217
217
def present_problem(req, subject, problemsrc):
218
218
    """Open a problem file, and write out the problem to the request in HTML.
219
219
    subject: Subject name.
220
 
    problemfile: "src" of the problem file. A path relative to the subject
221
 
        directory.
 
220
    problemsrc: "src" of the problem file. A path relative to the top-level
 
221
        subjects base directory, as configured in conf.
222
222
    """
223
223
    req.write('<div class="tuteproblem">\n')
224
224
    # First normalise the path
227
227
    if problemsrc.startswith("..") or problemsrc.startswith(os.sep):
228
228
        problemfile = None
229
229
    else:
230
 
        problemfile = os.path.join(conf.subjects_base, subject,
231
 
            problemsrc)
 
230
        problemfile = os.path.join(conf.subjects_base, problemsrc)
232
231
 
233
232
    try:
234
233
        problemfile = open(problemfile)