Skip to content

Commit

Permalink
accept kwars to be passed to get_api_endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
karkraeg committed May 23, 2024
1 parent 2141017 commit 5b6325c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions invenio_administration/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def _schema_to_json(self, schema):
"""
return jsonify_schema(schema)

def get_api_endpoint(self):
def get_api_endpoint(self, **kwargs):
"""Get search API endpoint."""
api_url_prefix = current_app.config["SITE_API_URL"]
slash_tpl = "/" if not self.api_endpoint.startswith("/") else ""
Expand Down Expand Up @@ -352,25 +352,25 @@ class AdminResourceListView(AdminResourceBaseView):

search_request_headers = {"Accept": "application/json"}

def get_search_request_headers(self):
def get_search_request_headers(self, **kwargs):
"""Get search request headers."""
return self.search_request_headers

def get_search_app_name(self):
def get_search_app_name(self, **kwargs):
"""Get search app name."""
if self.search_config_name is None:
return f"{self.name.upper()}_SEARCH"
return self.search_config_name

def init_search_config(self):
def init_search_config(self, **kwargs):
"""Build search view config."""
return partial(
search_app_config,
config_name=self.get_search_app_name(),
config_name=self.get_search_app_name(**kwargs),
available_facets=current_app.config.get(self.search_facets_config_name),
sort_options=current_app.config[self.search_sort_config_name],
endpoint=self.get_api_endpoint(),
headers=self.get_search_request_headers(),
endpoint=self.get_api_endpoint(**kwargs),
headers=self.get_search_request_headers(**kwargs),
)

def get_sort_options(self):
Expand All @@ -387,7 +387,7 @@ def get_available_facets(self):

def get_context(self, **kwargs):
"""Create details view context."""
search_conf = self.init_search_config()
search_conf = self.init_search_config(**kwargs)
schema = self.get_service_schema()
serialized_schema = self._schema_to_json(schema)
pid_value = kwargs.get("pid_value", "")
Expand Down

0 comments on commit 5b6325c

Please sign in to comment.