|
1 | 1 | from typing import Dict
|
2 |
| -from flask import Blueprint, request, render_template |
| 2 | +from flask import Blueprint, request, send_file |
3 | 3 |
|
4 | 4 | from oaipmh.requests.info_queries import identify, list_metadata_formats, list_sets
|
5 | 5 | from oaipmh.requests.data_queries import get_record, list_data
|
@@ -42,24 +42,19 @@ def oai() -> Response:
|
42 | 42 |
|
43 | 43 | @blueprint.route("/OAI/arXivRaw.xsd", methods=['GET', 'POST'])
|
44 | 44 | def schema_arXivRaw() -> Response:
|
45 |
| - response=render_template("schema/arXivRaw.xsd") |
46 |
| - headers={} |
47 |
| - headers["Content-Type"]="application/xml" |
48 |
| - return response, 200, headers |
| 45 | + file_path = "templates/schema/arXivRaw.xsd" |
| 46 | + return send_file(file_path, mimetype="application/xml") |
| 47 | + |
49 | 48 |
|
50 | 49 | @blueprint.route("/OAI/arXiv.xsd", methods=['GET', 'POST'])
|
51 | 50 | def schema_arXiv() -> Response:
|
52 |
| - response=render_template("schema/arXiv.xsd") |
53 |
| - headers={} |
54 |
| - headers["Content-Type"]="application/xml" |
55 |
| - return response, 200, headers |
| 51 | + file_path = "templates/schema/arXiv.xsd" |
| 52 | + return send_file(file_path, mimetype="application/xml") |
56 | 53 |
|
57 | 54 | @blueprint.route("/OAI/arXivOld.xsd", methods=['GET', 'POST'])
|
58 | 55 | def schema_arXivOld() -> Response:
|
59 |
| - response=render_template("schema/arXivOld.xsd") |
60 |
| - headers={} |
61 |
| - headers["Content-Type"]="application/xml" |
62 |
| - return response, 200, headers |
| 56 | + file_path = "templates/schema/arXivOld.xsd" |
| 57 | + return send_file(file_path, mimetype="application/xml") |
63 | 58 |
|
64 | 59 | @blueprint.route('/favicon.ico')
|
65 | 60 | def favicon():
|
|
0 commit comments