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

« back to all changes in this revision

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

  • Committer: William Grant
  • Date: 2010-07-29 11:34:44 UTC
  • Revision ID: grantw@unimelb.edu.au-20100729113444-ht6s5kdcixvfubhr
Merge video and audio handlers, and reword them.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
    @require_permission('edit')
57
57
    def PUT(self, req, data):
58
58
        """ Tests the given submission """
 
59
        # Trim off any trailing whitespace (can cause syntax errors in python)
 
60
        # While technically this is a user error, it causes a lot of confusion 
 
61
        # for student since it's "invisible".
 
62
        code = data['code'].rstrip()
 
63
 
59
64
        test_results = ivle.worksheet.utils.test_exercise_submission(
60
65
            req.config, req.user, self.context.worksheet_exercise.exercise,
61
 
            data['code'])
 
66
            code)
62
67
 
63
68
        attempt = ivle.database.ExerciseAttempt(user=req.user,
64
69
            worksheet_exercise = self.context.worksheet_exercise,
65
70
            date = datetime.datetime.now(),
66
71
            complete = test_results['passed'],
67
 
            text = unicode(data['code'])
 
72
            text = unicode(code)
68
73
        )
69
74
 
70
75
        req.store.add(attempt)