def web_admin(module, action, arguments=None): """Add support for legacy mod publisher.""" from invenio.legacy.wsgi import \ is_mp_legacy_publisher_path, mp_legacy_publisher, \ application as legacy_application possible_module, possible_handler = is_mp_legacy_publisher_path( request.environ['PATH_INFO']) if possible_module is not None: legacy_publisher = lambda req: \ mp_legacy_publisher(req, possible_module, possible_handler) return legacy_application(request.environ, g.start_response, handler=legacy_publisher) return render_template('404.html'), 404
def page_not_found(error): try: from invenio.legacy.wsgi import \ application as legacy_application response = legacy_application(request.environ, g.start_response) if not isinstance(response, BaseResponse): response = current_app.make_response(str(response)) return response except HTTPException as e: current_app.logger.exception(request.path) error = e if error.code == 404: return render_template('404.html'), 404 return str(error), error.code
def web_admin(module, action, arguments=None): """Add support for legacy mod publisher.""" from invenio.legacy.wsgi import \ is_mp_legacy_publisher_path, mp_legacy_publisher, \ application as legacy_application possible_module, possible_handler = is_mp_legacy_publisher_path( request.environ['PATH_INFO']) if possible_module is not None: def legacy_publisher(req): return mp_legacy_publisher(req, possible_module, possible_handler) return legacy_application(request.environ, g.start_response, handler=legacy_publisher) return render_template('404.html'), 404
def page_not_found(error): try: from invenio.legacy.wsgi import \ application as legacy_application response = legacy_application(request.environ, g.start_response) if not isinstance(response, BaseResponse): response = current_app.make_response(str(response)) if response.status_code == 404: return render_template('404.html'), 404 else: return response except HTTPException as e: if e.code != 404: current_app.logger.exception(request.path) error = e if error.code == 404: return render_template('404.html'), 404 return str(error), error.code