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

« back to all changes in this revision

Viewing changes to ivle/dispatch/__init__.py

  • Committer: David Coles
  • Date: 2009-07-30 07:46:28 UTC
  • Revision ID: coles.david@gmail.com-20090730074628-9lm1hyjmobpvwhy3
Fix the console input UI so that it displays propperly regardless of window width
 by laying it out with 'display: table'. Also fixed file browser spacing since
console overlapped the status bar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
139
139
            req.store.commit()
140
140
            return req.OK
141
141
    else:
 
142
        req.status = 404
142
143
        XHTMLErrorView(req, NotFound()).render(req)
143
144
        return req.OK
144
145
 
155
156
    req.content_type = "text/html"
156
157
    logfile = os.path.join(config['paths']['logs'], 'ivle_error.log')
157
158
    logfail = False
 
159
 
 
160
    # XXX: This remains here for ivle.interpret's IVLEErrors. Once we rewrite
 
161
    #      fileservice, req.status should always be 500 (ISE) here.
158
162
    try:
159
163
        httpcode = exc_value.httpcode
160
164
        req.status = httpcode
161
165
    except AttributeError:
162
166
        httpcode = None
163
167
        req.status = mod_python.apache.HTTP_INTERNAL_SERVER_ERROR
 
168
 
164
169
    try:
165
170
        publicmode = req.publicmode
166
171
    except AttributeError:
189
194
    # misbehaves (which is currently very easy, if things aren't set up
190
195
    # correctly).
191
196
    # Write the traceback.
192
 
    # If this is a non-4xx IVLEError, get the message and httpcode and
193
 
    # make the error message a bit nicer (but still include the
194
 
    # traceback).
195
 
    # We also need to special-case IVLEJailError, as we can get another
 
197
 
 
198
    # We need to special-case IVLEJailError, as we can get another
196
199
    # almost-exception out of it.
197
 
 
198
 
    codename, msg = None, None
199
 
 
200
200
    if exc_type is util.IVLEJailError:
201
 
        msg = exc_value.type_str + ": " + exc_value.message
202
201
        tb = 'Exception information extracted from IVLEJailError:\n'
203
202
        tb += urllib.unquote(exc_value.info)
204
203
    else:
205
 
        try:
206
 
            codename, msg = req.get_http_codename(httpcode)
207
 
        except AttributeError:
208
 
            pass
209
 
 
210
204
        tb = ''.join(traceback.format_exception(exc_type, exc_value,
211
205
                                                exc_traceback))
212
206
 
213
 
    logging.error('%s\n%s'%(str(msg), tb))
 
207
    logging.error('\n' + tb)
214
208
 
215
209
    # Error messages are only displayed is the user is NOT a student,
216
210
    # or if there has been a problem logging the error message
220
214
<html xmlns="http://www.w3.org/1999/xhtml">
221
215
<head><title>IVLE Internal Server Error</title></head>
222
216
<body>
223
 
<h1>IVLE Internal Server Error""")
224
 
    if show_errors:
225
 
        if codename is not None and \
226
 
           httpcode != mod_python.apache.HTTP_INTERNAL_SERVER_ERROR:
227
 
            req.write(": %s" % cgi.escape(codename))
228
 
 
229
 
    req.write("""</h1>
 
217
<h1>IVLE Internal Server Error</h1>
230
218
<p>An error has occured which is the fault of the IVLE developers or
231
219
administrators. """)
232
220
 
238
226
    req.write("</p>")
239
227
 
240
228
    if show_errors:
241
 
        if msg is not None:
242
 
            req.write("<p>%s</p>\n" % cgi.escape(msg))
243
 
        if httpcode is not None:
244
 
            req.write("<p>(HTTP error code %d)</p>\n" % httpcode)
245
229
        req.write("<h2>Debugging information</h2>")
246
 
 
247
230
        req.write("<pre>\n%s\n</pre>\n"%cgi.escape(tb))
248
231
    req.write("</body></html>")