def show(id=1): try: m_sections = Section() m_section = m_sections.read_data(id) # html or Json response if request_wants_json(): return jsonify(data=m_section) else: return render_template("sections/show.html", section=m_section, app=app) except Exception, ex: print("------------ ERROR ------------\n" + str(ex.message)) flash(str(ex.message), category="warning") abort(404)