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

Commit 0439d7516cf774dfcb028397a185a82f41f5a9d4

better error handling
app/app.py
(14 / 4)
  
183183 return redirect('/context/reviews/%s' % context_guid)
184184 try:
185185 client.launch(context_guid)
186 except ServerError:
186 except ServerError,RuntimeError:
187187 pass
188188 return redirect('/context/reviews/%s' % context_guid)
189189
391391 query='', total_pages=0, browser_view='true',
392392 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
394401@app.route('/resource/contexts/<query>')
395402@app.route('/resource/contexts/')
396403@app.route('/context/search/')
504504 else:
505505 template='context-view.html'
506506 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'])
508508 try:
509509 session['last_context_title']=context['title']
510510 except RuntimeError:
606606 session['last_context']=context['guid']
607607 session['last_context_title']=context['title']
608608 session.modified = True
609 except ServerError:
609 except RuntimeError:
610610 abort(404)
611611
612612 stroke, fill = get_colors()
647647 resource['title']=request.form['title']
648648 if request.form.get('content'):
649649 resource['content']=request.form['content']
650 resource.post()
650 try:
651 resource.post()
652 except NotFound:
653 abort(500)
651654 resource_cursor._reset()
652655 return redirect(request.form.get('href'))
653656