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

« back to all changes in this revision

Viewing changes to ivle/webapp/tutorial/__init__.py

Remove remaining uses of req.throw_error in the new webapps.

Show diffs side-by-side

added added

removed removed

Lines of Context:
339
339
    #Open the exercise, and double-check that it exists
340
340
    exercisefile = ivle.util.open_exercise_file(exercisesrc)
341
341
    if exercisefile is None:
342
 
        req.throw_error(req.HTTP_EXPECTATION_FAILED, \
343
 
                                        "Exercise file could not be opened")
344
 
    
 
342
        raise NotFound()
 
343
 
345
344
    # Read exercise file and present the exercise
346
345
    # Note: We do not use the testing framework because it does a lot more
347
346
    # work than we need. We just need to get the exercise name and a few other
351
350
    exercisedom = minidom.parse(exercisefile)
352
351
    exercisefile.close()
353
352
    exercisedom = exercisedom.documentElement
354
 
    if exercisedom.tagName != "exercise":
355
 
        req.throw_error(req.HTTP_INTERNAL_SERVER_ERROR,
356
 
            "The exercise XML file's top-level element must be <exercise>.")
 
353
    assert exercisedom.tagName == "exercise", \
 
354
           "Exercise file top-level element must be <exercise>."
357
355
    curctx['exercisename'] = exercisedom.getAttribute("name")
358
 
    
 
356
 
359
357
    curctx['rows'] = exercisedom.getAttribute("rows")
360
358
    if not curctx['rows']:
361
359
        curctx['rows'] = "12"