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

« back to all changes in this revision

Viewing changes to ivle/interpret.py

  • Committer: William Grant
  • Date: 2010-03-03 04:16:37 UTC
  • Revision ID: grantw@unimelb.edu.au-20100303041637-d2846flg51nt81wb
Don't try to create IVLEJailErrors out of CGI headers when we're executing student code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
215
215
            if len(split) == 1:
216
216
                split = headers.split('\n', 1)
217
217
 
218
 
        # Is this an internal IVLE error condition?
219
 
        hs = cgiflags.headers
220
 
        if 'X-IVLE-Error-Type' in hs:
221
 
            try:
222
 
                raise IVLEJailError(hs['X-IVLE-Error-Type'],
223
 
                                    hs['X-IVLE-Error-Message'],
224
 
                                    hs['X-IVLE-Error-Info'])
225
 
            except KeyError:
226
 
                raise AssertionError("Bad error headers written by CGI.")
 
218
        # If not executing in gentle mode (which presents CGI violations
 
219
        # to users nicely), check if this an internal IVLE error
 
220
        # condition.
 
221
        if not cgiflags.gentle:
 
222
            hs = cgiflags.headers
 
223
            if 'X-IVLE-Error-Type' in hs:
 
224
                try:
 
225
                    raise IVLEJailError(hs['X-IVLE-Error-Type'],
 
226
                                        hs['X-IVLE-Error-Message'],
 
227
                                        hs['X-IVLE-Error-Info'])
 
228
                except KeyError:
 
229
                    raise AssertionError("Bad error headers written by CGI.")
227
230
 
228
231
        # Check to make sure the required headers were written
229
232
        if cgiflags.wrote_html_warning or not cgiflags.gentle: