Web · Wiki · Activities · Blog · Lists · Chat · Meeting · Bugs · Git · Translate · Archive · People · Donate

Commit 0439d7516cf774dfcb028397a185a82f41f5a9d4

better error handling
  • Diff rendering mode:
  • inline
  • side by side

app/app.py

183 return redirect('/context/reviews/%s' % context_guid)183 return redirect('/context/reviews/%s' % context_guid)
184 try:184 try:
185 client.launch(context_guid)185 client.launch(context_guid)
186 except ServerError:
186 except ServerError,RuntimeError:
187 pass187 pass
188 return redirect('/context/reviews/%s' % context_guid)188 return redirect('/context/reviews/%s' % context_guid)
189189
391 query='', total_pages=0, browser_view='true',391 query='', total_pages=0, browser_view='true',
392 result=[], type='context', meta=_('Object not found.'), page=1) 392 result=[], type='context', meta=_('Object not found.'), page=1)
393393
394@app.errorhandler(500)
395def page_not_found(error):
396 template='browser-view.html'
397 return render_template(template, total=0, info=_('Error'), resource_type='context',
398 query='', total_pages=0, browser_view='true',
399 result=[], type='context', meta=_('Server error.'), page=1)
400
394@app.route('/resource/contexts/<query>')401@app.route('/resource/contexts/<query>')
395@app.route('/resource/contexts/')402@app.route('/resource/contexts/')
396@app.route('/context/search/')403@app.route('/context/search/')
504 else:504 else:
505 template='context-view.html'505 template='context-view.html'
506 context=g.client.Context(resource_guid,506 context=g.client.Context(resource_guid,
507 reply=['guid', 'title', 'description', 'author', 'user', 'keep', 'keep_impl'])
507 reply=['guid', 'title', 'description', 'author', 'user', 'keep', 'keep_impl', 'type'])
508 try:508 try:
509 session['last_context_title']=context['title']509 session['last_context_title']=context['title']
510 except RuntimeError:510 except RuntimeError:
606 session['last_context']=context['guid']606 session['last_context']=context['guid']
607 session['last_context_title']=context['title']607 session['last_context_title']=context['title']
608 session.modified = True608 session.modified = True
609 except ServerError:
609 except RuntimeError:
610 abort(404)610 abort(404)
611611
612 stroke, fill = get_colors()612 stroke, fill = get_colors()
647 resource['title']=request.form['title']647 resource['title']=request.form['title']
648 if request.form.get('content'):648 if request.form.get('content'):
649 resource['content']=request.form['content']649 resource['content']=request.form['content']
650 resource.post()
650 try:
651 resource.post()
652 except NotFound:
653 abort(500)
651 resource_cursor._reset()654 resource_cursor._reset()
652 return redirect(request.form.get('href'))655 return redirect(request.form.get('href'))
653656