Skip to content

Commit

Permalink
create basic request element
Browse files Browse the repository at this point in the history
  • Loading branch information
kyokukou committed Nov 5, 2024
1 parent 7b68c94 commit a66d6ad
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions oaipmh/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class Settings(arxiv_base.Settings):
SQLALCHEMY_MAX_OVERFLOW: Optional[int] = 0
SQLALCHEMY_POOL_SIZE: Optional[int] = 10

FLASKS3_BUCKET_NAME: str = "some_bucket" #TODO needed to use url for for some reason?

def check(self) -> None:
"""A check and fix up of a settings object."""
if 'sqlite' in self.CLASSIC_DB_URI:
Expand Down
8 changes: 6 additions & 2 deletions oaipmh/requests/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ def oai() -> Response:
request_info="request info", #TODO
interior_xml="interior data" #TODO
)

headers={"Content-Type":"application/xml"}

return response_xml, 200, headers
return response_xml, 200, headers

@blueprint.route('/favicon.ico')
def favicon():
#TODO
return '', 204
3 changes: 2 additions & 1 deletion oaipmh/templates/base.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
{% import 'macros.html' as macros %}
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">
<responseDate>{{ response_date.strftime("%Y-%m-%dT%H:%M:%SZ") }}</responseDate>
{{ request_info }}
{{macros.request_element()}}
{{interior_xml}}
</OAI-PMH>
3 changes: 3 additions & 0 deletions oaipmh/templates/macros.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% macro request_element( attributes={}) %}
<request {% for key, value in attributes.items() %}{{ key }}="{{ value }}" {% endfor %}>{{ url_for("general.oai", _external=True) }}</request>
{% endmacro %}

0 comments on commit a66d6ad

Please sign in to comment.