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

« back to all changes in this revision

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

  • Committer: David Coles
  • Date: 2010-07-17 11:32:50 UTC
  • Revision ID: coles.david@gmail.com-20100717113250-vi18n50bcjmfmzrt
Show warning for CGI header field-names which contain restricted characters.

Forbidden characters are the separators defined by RFC3875. This is mainly to 
fix an issue where printing a dictionary (with no CGI headers) could be 
assumed to be a CGI header with no warnings.

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
 
 
64
59
        test_results = ivle.worksheet.utils.test_exercise_submission(
65
60
            req.config, req.user, self.context.worksheet_exercise.exercise,
66
 
            code)
 
61
            data['code'])
67
62
 
68
63
        attempt = ivle.database.ExerciseAttempt(user=req.user,
69
64
            worksheet_exercise = self.context.worksheet_exercise,
70
65
            date = datetime.datetime.now(),
71
66
            complete = test_results['passed'],
72
 
            text = unicode(code)
 
67
            text = unicode(data['code'])
73
68
        )
74
69
 
75
70
        req.store.add(attempt)