core-explore-common-app 2.2.0__tar.gz → 2.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- core_explore_common_app-2.4.0/LICENSE.md +35 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/PKG-INFO +1 -1
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/access_control/api.py +19 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/components/query/api.py +26 -6
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/components/result/models.py +1 -0
- core_explore_common_app-2.4.0/core_explore_common_app/migrations/0002_result_blob_url.py +18 -0
- core_explore_common_app-2.4.0/core_explore_common_app/rest/query/views.py +181 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/rest/urls.py +0 -6
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/static/core_explore_common_app/user/css/results.css +1 -1
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/static/core_explore_common_app/user/js/results.js +8 -3
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/static/core_explore_common_app/user/js/results.raw.js +2 -1
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/templates/core_explore_common_app/commons/query_content.html +1 -1
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/templates/core_explore_common_app/user/ordering_menu/multi_criteria_sorting_menu.html +1 -1
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/templates/core_explore_common_app/user/ordering_menu/single_criteria_sorting_menu.html +1 -1
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/templates/core_explore_common_app/user/persistent_query/modal.html +8 -6
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/templates/core_explore_common_app/user/results/data_source_info.html +12 -2
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/templates/core_explore_common_app/user/results/data_sources_results.html +2 -2
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/urls.py +2 -2
- core_explore_common_app-2.4.0/core_explore_common_app/utils/linked_records/pid.py +46 -0
- core_explore_common_app-2.4.0/core_explore_common_app/utils/oaipmh/oaipmh.py +26 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/utils/query/query.py +28 -71
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/views/user/ajax.py +83 -49
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/views/user/views.py +1 -2
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app.egg-info/PKG-INFO +1 -1
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app.egg-info/SOURCES.txt +20 -2
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app.egg-info/requires.txt +1 -1
- core_explore_common_app-2.4.0/requirements.core.txt +1 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/setup.py +1 -1
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/tests/components/query/tests_unit.py +34 -5
- core_explore_common_app-2.4.0/tests/rest/query/__init__.py +0 -0
- core_explore_common_app-2.4.0/tests/rest/query/views/__init__.py +0 -0
- core_explore_common_app-2.4.0/tests/rest/query/views/tests_unit.py +110 -0
- core_explore_common_app-2.4.0/tests/rest/result/__init__.py +0 -0
- core_explore_common_app-2.4.0/tests/rest/result/tests_unit.py +104 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/tests/test_settings.py +6 -1
- core_explore_common_app-2.4.0/tests/urls.py +32 -0
- core_explore_common_app-2.4.0/tests/utils/__init__.py +0 -0
- core_explore_common_app-2.4.0/tests/utils/linked_records/__init__.py +0 -0
- core_explore_common_app-2.4.0/tests/utils/linked_records/tests_pid.py +128 -0
- core_explore_common_app-2.4.0/tests/utils/oaipmh/__init__.py +0 -0
- core_explore_common_app-2.4.0/tests/utils/oaipmh/tests_oaipmh.py +61 -0
- core_explore_common_app-2.4.0/tests/utils/query/__init__.py +0 -0
- core_explore_common_app-2.4.0/tests/utils/query/tests_query.py +95 -0
- core_explore_common_app-2.4.0/tests/views/__init__.py +0 -0
- core_explore_common_app-2.4.0/tests/views/test_unit.py +550 -0
- core_explore_common_app-2.2.0/core_explore_common_app/rest/query/views.py +0 -108
- core_explore_common_app-2.2.0/requirements.core.txt +0 -1
- core_explore_common_app-2.2.0/tests/rest/query/tests_permissions.py +0 -123
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/MANIFEST.in +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/README.rst +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/__init__.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/access_control/__init__.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/admin.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/apps.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/commons/__init__.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/commons/exceptions.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/components/__init__.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/components/abstract_persistent_query/__init__.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/components/abstract_persistent_query/api.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/components/abstract_persistent_query/models.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/components/abstract_query/__init__.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/components/abstract_query/models.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/components/query/__init__.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/components/query/admin_site.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/components/query/models.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/components/result/__init__.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/constants.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/discover.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/migrations/0001_initial.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/migrations/__init__.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/rest/__init__.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/rest/query/__init__.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/rest/result/__init__.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/rest/result/serializers.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/rest/result/views.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/settings.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/static/core_explore_common_app/common/js/tools.js +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/static/core_explore_common_app/user/css/query_result.css +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/static/core_explore_common_app/user/css/toggle.css +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/static/core_explore_common_app/user/js/local_selector.js +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/static/core_explore_common_app/user/js/persistent_query_config.js +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/static/core_explore_common_app/user/js/sorting_multi_criteria.js +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/static/core_explore_common_app/user/js/sorting_single_criteria.js +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/system/__init__.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/system/api.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/tasks.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/templates/core_explore_common_app/admin/persistent_query/content_query_box.html +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/templates/core_explore_common_app/admin/persistent_query/view_query_content.html +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/templates/core_explore_common_app/user/persistent_query/button.html +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/templates/core_explore_common_app/user/persistent_query/persistent_query_content.html +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/templates/core_explore_common_app/user/persistent_query/persistent_query_pagination.html +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/templates/core_explore_common_app/user/results/data_source_pagination.html +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/templates/core_explore_common_app/user/results/data_source_results.html +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/templates/core_explore_common_app/user/results/results.html +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/templates/core_explore_common_app/user/selector/data_sources_selector.html +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/templates/core_explore_common_app/user/selector/list_selector_base.html +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/templates/core_explore_common_app/user/selector/local_content.html +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/templates/core_explore_common_app/user/selector/local_selector.html +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/utils/__init__.py +0 -0
- {core_explore_common_app-2.2.0/core_explore_common_app/utils/protocols → core_explore_common_app-2.4.0/core_explore_common_app/utils/linked_records}/__init__.py +0 -0
- {core_explore_common_app-2.2.0/core_explore_common_app/utils/query → core_explore_common_app-2.4.0/core_explore_common_app/utils/oaipmh}/__init__.py +0 -0
- {core_explore_common_app-2.2.0/core_explore_common_app/utils/result → core_explore_common_app-2.4.0/core_explore_common_app/utils/protocols}/__init__.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/utils/protocols/commons.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/utils/protocols/oauth2.py +0 -0
- {core_explore_common_app-2.2.0/core_explore_common_app/views → core_explore_common_app-2.4.0/core_explore_common_app/utils/query}/__init__.py +0 -0
- {core_explore_common_app-2.2.0/core_explore_common_app/views/user → core_explore_common_app-2.4.0/core_explore_common_app/utils/result}/__init__.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/utils/result/result.py +0 -0
- {core_explore_common_app-2.2.0/tests → core_explore_common_app-2.4.0/core_explore_common_app/views}/__init__.py +0 -0
- {core_explore_common_app-2.2.0/tests/components → core_explore_common_app-2.4.0/core_explore_common_app/views/user}/__init__.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app.egg-info/dependency_links.txt +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app.egg-info/top_level.txt +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/pyproject.toml +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/setup.cfg +0 -0
- {core_explore_common_app-2.2.0/tests/components/abstract_persistent_query → core_explore_common_app-2.4.0/tests}/__init__.py +0 -0
- {core_explore_common_app-2.2.0/tests/components/query → core_explore_common_app-2.4.0/tests/components}/__init__.py +0 -0
- {core_explore_common_app-2.2.0/tests/rest → core_explore_common_app-2.4.0/tests/components/abstract_persistent_query}/__init__.py +0 -0
- {core_explore_common_app-2.2.0/tests/rest → core_explore_common_app-2.4.0/tests/components}/query/__init__.py +0 -0
- {core_explore_common_app-2.2.0/tests/rest/result → core_explore_common_app-2.4.0/tests/rest}/__init__.py +0 -0
- {core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/tests/rest/result/tests_permissions.py +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# NIST Software Licensing Statement
|
|
2
|
+
|
|
3
|
+
NIST-developed software is provided by NIST as a public service.
|
|
4
|
+
You may use, copy, and distribute copies of the software in any
|
|
5
|
+
medium, provided that you keep intact this entire notice. You may
|
|
6
|
+
improve, modify, and create derivative works of the software or
|
|
7
|
+
any portion of the software, and you may copy and distribute such
|
|
8
|
+
modifications or works. Modified works should carry a notice
|
|
9
|
+
stating that you changed the software and should note the date
|
|
10
|
+
and nature of any such change. Please explicitly acknowledge the
|
|
11
|
+
National Institute of Standards and Technology as the source of
|
|
12
|
+
the software.
|
|
13
|
+
|
|
14
|
+
NIST-developed software is expressly provided "AS IS." NIST MAKES
|
|
15
|
+
NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT, OR ARISING BY
|
|
16
|
+
OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
17
|
+
WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
|
|
18
|
+
NON-INFRINGEMENT, AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR
|
|
19
|
+
WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED
|
|
20
|
+
OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES
|
|
21
|
+
NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE
|
|
22
|
+
SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE
|
|
23
|
+
CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE
|
|
24
|
+
SOFTWARE.
|
|
25
|
+
|
|
26
|
+
You are solely responsible for determining the appropriateness of
|
|
27
|
+
using and distributing the software and you assume all risks
|
|
28
|
+
associated with its use, including but not limited to the risks
|
|
29
|
+
and costs of program errors, compliance with applicable laws,
|
|
30
|
+
damage to or loss of data, programs or equipment, and the
|
|
31
|
+
unavailability or interruption of operation. This software is not
|
|
32
|
+
intended to be used in any situation where a failure could cause
|
|
33
|
+
risk of injury or damage to property. The software developed by
|
|
34
|
+
NIST employees is not subject to copyright protection within the
|
|
35
|
+
United States.
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import logging
|
|
4
4
|
|
|
5
5
|
from django.contrib.auth.models import User, AnonymousUser
|
|
6
|
+
from django.http import HttpRequest
|
|
6
7
|
|
|
7
8
|
from core_main_app.access_control.exceptions import AccessControlError
|
|
8
9
|
from core_explore_common_app.components.abstract_persistent_query.models import (
|
|
@@ -12,6 +13,7 @@ from core_explore_common_app.components.query.models import Query
|
|
|
12
13
|
from core_explore_common_app.settings import (
|
|
13
14
|
CAN_ANONYMOUS_ACCESS_PUBLIC_DOCUMENT,
|
|
14
15
|
)
|
|
16
|
+
from core_main_app.access_control import api as access_control_api
|
|
15
17
|
|
|
16
18
|
logger = logging.getLogger(__name__)
|
|
17
19
|
|
|
@@ -167,3 +169,20 @@ def can_write_persistent_query(func, *args, **kwargs):
|
|
|
167
169
|
raise AccessControlError(
|
|
168
170
|
"The user doesn't have enough rights to access this query."
|
|
169
171
|
)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def can_access_explore_views(func, *args, **kwargs):
|
|
175
|
+
"""Check if user can access explore views
|
|
176
|
+
|
|
177
|
+
Args:
|
|
178
|
+
func:
|
|
179
|
+
request:
|
|
180
|
+
|
|
181
|
+
Returns:
|
|
182
|
+
|
|
183
|
+
"""
|
|
184
|
+
request = next((arg for arg in args if isinstance(arg, HttpRequest)), None)
|
|
185
|
+
access_control_api._check_anonymous_access(
|
|
186
|
+
request.user if request else None
|
|
187
|
+
)
|
|
188
|
+
return func(*args, **kwargs)
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
""" Query api
|
|
2
2
|
"""
|
|
3
3
|
|
|
4
|
-
from core_main_app.access_control.decorators import access_control
|
|
5
|
-
from core_main_app.commons.exceptions import DoesNotExist
|
|
6
|
-
from core_main_app.utils.query.constants import VISIBILITY_OPTION
|
|
7
4
|
from core_explore_common_app import settings
|
|
8
5
|
from core_explore_common_app.access_control.api import can_read, can_access
|
|
9
6
|
from core_explore_common_app.components.query.models import Query
|
|
10
|
-
from core_explore_common_app.constants import LOCAL_QUERY_NAME
|
|
11
7
|
from core_explore_common_app.settings import (
|
|
12
8
|
EXPLORE_ADD_DEFAULT_LOCAL_DATA_SOURCE_TO_QUERY,
|
|
13
9
|
)
|
|
14
|
-
from core_explore_common_app.utils.query.query import
|
|
10
|
+
from core_explore_common_app.utils.query.query import (
|
|
11
|
+
create_local_data_source,
|
|
12
|
+
is_local_data_source,
|
|
13
|
+
)
|
|
14
|
+
from core_main_app.access_control.decorators import access_control
|
|
15
|
+
from core_main_app.commons.exceptions import DoesNotExist
|
|
16
|
+
from core_main_app.utils.query.constants import VISIBILITY_OPTION
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
@access_control(can_access)
|
|
@@ -20,6 +22,7 @@ def upsert(query, user):
|
|
|
20
22
|
|
|
21
23
|
Args:
|
|
22
24
|
query:
|
|
25
|
+
user:
|
|
23
26
|
|
|
24
27
|
Returns:
|
|
25
28
|
|
|
@@ -52,12 +55,29 @@ def create_default_query(request, template_ids):
|
|
|
52
55
|
return query
|
|
53
56
|
|
|
54
57
|
|
|
58
|
+
def add_local_data_source(request, query):
|
|
59
|
+
"""Add local data source to query
|
|
60
|
+
|
|
61
|
+
Args:
|
|
62
|
+
request:
|
|
63
|
+
query:
|
|
64
|
+
|
|
65
|
+
Returns:
|
|
66
|
+
|
|
67
|
+
"""
|
|
68
|
+
# Add Local to the query as a data source
|
|
69
|
+
data_source = create_local_data_source(request)
|
|
70
|
+
# Add data source to query (with access control)
|
|
71
|
+
add_data_source(query, data_source, request.user)
|
|
72
|
+
|
|
73
|
+
|
|
55
74
|
@access_control(can_read)
|
|
56
75
|
def get_by_id(id_query, user):
|
|
57
76
|
"""Returns a query with the given id
|
|
58
77
|
|
|
59
78
|
Args:
|
|
60
79
|
id_query:
|
|
80
|
+
user:
|
|
61
81
|
|
|
62
82
|
Returns:
|
|
63
83
|
|
|
@@ -139,7 +159,7 @@ def set_visibility_to_query(query, user):
|
|
|
139
159
|
# Set visibility option for local data source
|
|
140
160
|
for data_source in query.data_sources:
|
|
141
161
|
# find local data source
|
|
142
|
-
if data_source
|
|
162
|
+
if is_local_data_source(data_source):
|
|
143
163
|
# set visibility to public
|
|
144
164
|
data_source["query_options"] = {
|
|
145
165
|
VISIBILITY_OPTION: settings.QUERY_VISIBILITY
|
|
@@ -13,3 +13,4 @@ class Result(models.Model):
|
|
|
13
13
|
detail_url = models.CharField(blank=True, null=True, max_length=200)
|
|
14
14
|
access_data_url = models.CharField(blank=True, null=True, max_length=200)
|
|
15
15
|
last_modification_date = models.DateTimeField(blank=True, default=None)
|
|
16
|
+
blob_url = models.CharField(blank=True, null=True, max_length=200)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Generated by Django 3.2.18 on 2023-05-05 13:25
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
("core_explore_common_app", "0001_initial"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AddField(
|
|
14
|
+
model_name="result",
|
|
15
|
+
name="blob_url",
|
|
16
|
+
field=models.CharField(blank=True, max_length=200, null=True),
|
|
17
|
+
),
|
|
18
|
+
]
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
""" REST views for the query API
|
|
2
|
+
"""
|
|
3
|
+
import json
|
|
4
|
+
import logging
|
|
5
|
+
|
|
6
|
+
import pytz
|
|
7
|
+
from django.conf import settings as conf_settings
|
|
8
|
+
from django import urls as django_urls
|
|
9
|
+
|
|
10
|
+
from core_explore_common_app.components.result.models import Result
|
|
11
|
+
from core_explore_common_app.utils.linked_records import pid as pid_utils
|
|
12
|
+
from core_explore_common_app.utils.result import result as result_utils
|
|
13
|
+
from core_main_app.access_control.exceptions import AccessControlError
|
|
14
|
+
from core_main_app.commons.constants import DATA_JSON_FIELD
|
|
15
|
+
from core_main_app.commons.exceptions import ApiError
|
|
16
|
+
from core_main_app.components.data import api as data_api
|
|
17
|
+
from core_main_app.rest.data.abstract_views import (
|
|
18
|
+
AbstractExecuteLocalQueryView,
|
|
19
|
+
)
|
|
20
|
+
from core_main_app.settings import DATA_SORTING_FIELDS, RESULTS_PER_PAGE
|
|
21
|
+
from core_main_app.utils.pagination.django_paginator.results_paginator import (
|
|
22
|
+
ResultsPaginator,
|
|
23
|
+
)
|
|
24
|
+
from core_main_app.utils.pagination.mongoengine_paginator.paginator import (
|
|
25
|
+
MongoenginePaginator,
|
|
26
|
+
)
|
|
27
|
+
from core_main_app.utils.query.constants import VISIBILITY_OPTION
|
|
28
|
+
from core_main_app.utils.query.mongo.query_builder import QueryBuilder
|
|
29
|
+
|
|
30
|
+
logger = logging.getLogger(__name__)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def build_local_query(query_data):
|
|
34
|
+
"""Build a query for local data.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
query_data (dict): Query to execute locally.
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
dict: Raw query for local data.
|
|
41
|
+
"""
|
|
42
|
+
# get query and templates
|
|
43
|
+
query = query_data.get("query", None)
|
|
44
|
+
|
|
45
|
+
if query is None:
|
|
46
|
+
raise ApiError("Query should be passed in parameter.")
|
|
47
|
+
|
|
48
|
+
templates = query_data.get("templates", [])
|
|
49
|
+
if type(templates) is str:
|
|
50
|
+
templates = json.loads(templates)
|
|
51
|
+
options = query_data.get("options", {})
|
|
52
|
+
if type(options) is str:
|
|
53
|
+
options = json.loads(options)
|
|
54
|
+
title = query_data.get("title", None)
|
|
55
|
+
|
|
56
|
+
# build query builder
|
|
57
|
+
query_builder = QueryBuilder(query, DATA_JSON_FIELD)
|
|
58
|
+
|
|
59
|
+
# update the criteria with templates information
|
|
60
|
+
if templates is not None and len(templates) > 0:
|
|
61
|
+
list_template_ids = [
|
|
62
|
+
AbstractExecuteLocalQueryView.parse_id(template["id"])
|
|
63
|
+
for template in templates
|
|
64
|
+
]
|
|
65
|
+
query_builder.add_list_criteria("template", list_template_ids)
|
|
66
|
+
# update the criteria with visibility information
|
|
67
|
+
if options is not None and VISIBILITY_OPTION in options:
|
|
68
|
+
query_builder.add_visibility_criteria(options[VISIBILITY_OPTION])
|
|
69
|
+
# update the criteria with title information
|
|
70
|
+
if title is not None:
|
|
71
|
+
query_builder.add_title_criteria(title)
|
|
72
|
+
|
|
73
|
+
# get raw query
|
|
74
|
+
return query_builder.get_raw_query()
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def execute_local_query(query_data, page, request):
|
|
78
|
+
"""Execute query on local database
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
query_data:
|
|
82
|
+
page:
|
|
83
|
+
request:
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
|
|
87
|
+
"""
|
|
88
|
+
# build raw query
|
|
89
|
+
raw_query = build_local_query(query_data)
|
|
90
|
+
# retrieve order_by_field field
|
|
91
|
+
order_by_field = query_data.get("order_by_field", None)
|
|
92
|
+
order_by_field = (
|
|
93
|
+
order_by_field.split(",") if order_by_field else DATA_SORTING_FIELDS
|
|
94
|
+
)
|
|
95
|
+
# execute query
|
|
96
|
+
data_list = data_api.execute_json_query(
|
|
97
|
+
raw_query, request.user, order_by_field
|
|
98
|
+
)
|
|
99
|
+
# build result page
|
|
100
|
+
if conf_settings.MONGODB_INDEXING:
|
|
101
|
+
paginator = MongoenginePaginator(data_list, RESULTS_PER_PAGE)
|
|
102
|
+
page = paginator.get_page(page)
|
|
103
|
+
else:
|
|
104
|
+
paginator = ResultsPaginator()
|
|
105
|
+
page = paginator.get_results(data_list, page, RESULTS_PER_PAGE)
|
|
106
|
+
return page
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def format_local_results(results, request):
|
|
110
|
+
"""Format local results for explore app
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
results:
|
|
114
|
+
request:
|
|
115
|
+
|
|
116
|
+
Returns:
|
|
117
|
+
|
|
118
|
+
"""
|
|
119
|
+
# Get detail view base url (to be completed with data id)
|
|
120
|
+
data_detail_url_base = django_urls.reverse("core_main_app_data_detail")
|
|
121
|
+
try:
|
|
122
|
+
# Get blob url if blob endpoint available
|
|
123
|
+
blob_detail_url_base = django_urls.reverse("core_main_app_blob_detail")
|
|
124
|
+
except django_urls.NoReverseMatch:
|
|
125
|
+
blob_detail_url_base = None
|
|
126
|
+
|
|
127
|
+
url_access_data = django_urls.reverse(
|
|
128
|
+
"core_explore_common_app_get_result_from_data_id"
|
|
129
|
+
)
|
|
130
|
+
url_permission_data = django_urls.reverse(
|
|
131
|
+
"core_main_app_rest_data_permissions"
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
# Template info
|
|
135
|
+
template_info = dict()
|
|
136
|
+
# Init data list
|
|
137
|
+
data_list = []
|
|
138
|
+
|
|
139
|
+
for data in results.object_list:
|
|
140
|
+
# get data's template
|
|
141
|
+
template_id = data.template_id
|
|
142
|
+
# get and store data's template information
|
|
143
|
+
if template_id not in template_info:
|
|
144
|
+
template_info[template_id] = result_utils.get_template_info(
|
|
145
|
+
data.template
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
detail_url = f"{data_detail_url_base}?id={str(data.id)}"
|
|
149
|
+
|
|
150
|
+
# Use the PID link if the app is installed, and a PID is defined for the document
|
|
151
|
+
if pid_utils.auto_set_pid_enabled(
|
|
152
|
+
installed_apps=conf_settings.INSTALLED_APPS
|
|
153
|
+
):
|
|
154
|
+
pid_url = pid_utils.get_pid_url(data, request)
|
|
155
|
+
# Ensure the PID is set
|
|
156
|
+
detail_url = pid_url if pid_url else detail_url
|
|
157
|
+
|
|
158
|
+
# # Get blob attached to data if any
|
|
159
|
+
try:
|
|
160
|
+
blob = data.blob(request.user)
|
|
161
|
+
except AccessControlError:
|
|
162
|
+
blob = None
|
|
163
|
+
|
|
164
|
+
# Add Result to list of results
|
|
165
|
+
data_list.append(
|
|
166
|
+
Result(
|
|
167
|
+
title=data.title,
|
|
168
|
+
blob_url=f"{blob_detail_url_base}?id={blob.id}"
|
|
169
|
+
if blob_detail_url_base and blob
|
|
170
|
+
else None,
|
|
171
|
+
xml_content=data.xml_content,
|
|
172
|
+
template_info=template_info[template_id],
|
|
173
|
+
permission_url=f'{url_permission_data}?ids=%5B"{str(data.id)}"%5D',
|
|
174
|
+
detail_url=detail_url,
|
|
175
|
+
access_data_url=f"{url_access_data}?id={data.id}",
|
|
176
|
+
last_modification_date=data.last_modification_date.replace(
|
|
177
|
+
tzinfo=pytz.UTC
|
|
178
|
+
),
|
|
179
|
+
)
|
|
180
|
+
)
|
|
181
|
+
return data_list
|
{core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/rest/urls.py
RENAMED
|
@@ -3,15 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
from django.urls import re_path
|
|
5
5
|
|
|
6
|
-
from core_explore_common_app.rest.query import views as query_views
|
|
7
6
|
from core_explore_common_app.rest.result import views as result_views
|
|
8
7
|
|
|
9
8
|
urlpatterns = [
|
|
10
|
-
re_path(
|
|
11
|
-
r"^local-query",
|
|
12
|
-
query_views.ExecuteLocalQueryView.as_view(),
|
|
13
|
-
name="core_explore_common_local_query",
|
|
14
|
-
),
|
|
15
9
|
re_path(
|
|
16
10
|
r"^result",
|
|
17
11
|
result_views.get_result_from_data_id,
|
|
@@ -106,6 +106,11 @@ var getDataPermission = function() {
|
|
|
106
106
|
openEditRecord(target_id,$(editLinkElement));
|
|
107
107
|
});
|
|
108
108
|
}());
|
|
109
|
+
// show the open icon
|
|
110
|
+
var openLinkElement = inputElement.siblings(".permissions-link-open");
|
|
111
|
+
openLinkElement.css('display', "inline");
|
|
112
|
+
// add link to text editor
|
|
113
|
+
openLinkElement.attr("href", openRecordUrl + '?id=' + id);
|
|
109
114
|
}
|
|
110
115
|
}
|
|
111
116
|
},
|
|
@@ -130,16 +135,16 @@ openEditRecord = function(id, btnSelector) {
|
|
|
130
135
|
type : "POST",
|
|
131
136
|
dataType: "json",
|
|
132
137
|
data : {
|
|
133
|
-
|
|
138
|
+
"id": id
|
|
134
139
|
},
|
|
135
140
|
success: function(data){
|
|
136
141
|
window.location = data.url;
|
|
137
142
|
},
|
|
138
143
|
error:function(data){
|
|
139
|
-
$.notify("Error while opening the edit page.",
|
|
144
|
+
$.notify("Error while opening the edit page.", 'danger');
|
|
140
145
|
}
|
|
141
146
|
}).always(function(data) {
|
|
142
|
-
|
|
147
|
+
// get old button icon
|
|
143
148
|
hideSpinner(btnSelector.find("i"), icon)
|
|
144
149
|
});
|
|
145
150
|
};
|
|
@@ -3,4 +3,5 @@ var dataSortingFields = "{{data.data_sorting_fields}}";
|
|
|
3
3
|
var displayPersistentQueryButton = '{{display_persistent_query_button}}';
|
|
4
4
|
var defaultDataSortingFields = '{{data.default_data_sorting_fields}}';
|
|
5
5
|
var defaultDateToggleValue = '{{data.default_date_toggle_value}}'
|
|
6
|
-
var editRecordUrl = "{% url 'core_dashboard_edit_record' %}";
|
|
6
|
+
var editRecordUrl = "{% url 'core_dashboard_edit_record' %}";
|
|
7
|
+
var openRecordUrl = "{% url 'core_main_app_xml_text_editor_view' %}";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
<div >
|
|
3
|
-
<button type="button" class="btn btn-secondary float-right back-to-previous">
|
|
3
|
+
<button type="button" class="btn btn-secondary {% if BOOTSTRAP_VERSION == "4.6.2" %}float-right{% elif BOOTSTRAP_VERSION == "5.1.3"%}float-end{% endif %} back-to-previous">
|
|
4
4
|
<i class="fas fa-arrow-left"></i> Back to previous
|
|
5
5
|
</button>
|
|
6
6
|
<div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div class="filter">
|
|
2
|
-
<button id="result-button-filter{{data_source_index}}" class="result-toolbar-button" data-toggle="dropdown" aria-haspopup="true"
|
|
2
|
+
<button id="result-button-filter{{data_source_index}}" class="result-toolbar-button" {% if BOOTSTRAP_VERSION == "4.6.2" %}data-toggle{% elif BOOTSTRAP_VERSION == "5.1.3"%}data-bs-toggle{% endif %}="dropdown" aria-haspopup="true"
|
|
3
3
|
aria-expanded="false">
|
|
4
4
|
<i class="fas fa-sort-amount-up"></i> Sort
|
|
5
5
|
</button>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div class="filter">
|
|
2
|
-
<button id="result-button-filter{{data_source_index}}" class="result-toolbar-button" data-toggle="dropdown" aria-haspopup="true"
|
|
2
|
+
<button id="result-button-filter{{data_source_index}}" class="result-toolbar-button" {% if BOOTSTRAP_VERSION == "4.6.2" %}data-toggle{% elif BOOTSTRAP_VERSION == "5.1.3"%}data-bs-toggle{% endif %}="dropdown" aria-haspopup="true"
|
|
3
3
|
aria-expanded="false">
|
|
4
4
|
<i class="fas fa-sort-amount-up"></i> Sort
|
|
5
5
|
</button>
|
|
@@ -6,14 +6,16 @@
|
|
|
6
6
|
{% block modal_submit_id %}persistent-query-submit{% endblock %}
|
|
7
7
|
{% block modal_extra_content %}
|
|
8
8
|
{% if request.user.is_authenticated %}
|
|
9
|
-
<div class="
|
|
10
|
-
<div class="
|
|
9
|
+
<div class="row g-3 align-items-center" id="rename_tools">
|
|
10
|
+
<div class="col-auto">
|
|
11
11
|
Do you want to name this query?
|
|
12
12
|
</div>
|
|
13
|
-
<div class="
|
|
14
|
-
|
|
13
|
+
<div class="col-5">
|
|
14
|
+
<input type="text" id="persistent-query-name" class="form-control form-control-lg" placeholder="Query name">
|
|
15
|
+
</div>
|
|
16
|
+
<div class="col-auto">
|
|
17
|
+
<button id="persistent-query-rename" class="btn btn-secondary" disabled="disabled">Rename</button>
|
|
15
18
|
</div>
|
|
16
|
-
<button id="persistent-query-rename" class="btn btn-secondary" disabled="disabled">Rename</button>
|
|
17
19
|
</div>
|
|
18
20
|
{% endif %}
|
|
19
|
-
{% endblock %}
|
|
21
|
+
{% endblock %}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
{% load json_date %}
|
|
2
|
+
{% load parse_date %}
|
|
3
|
+
{% load tz %}
|
|
2
4
|
|
|
3
5
|
<div class="result-line-main-container" name="result">
|
|
4
6
|
<div class="result-line-title-container">
|
|
@@ -15,15 +17,23 @@
|
|
|
15
17
|
{{ result.title }}
|
|
16
18
|
{% endif %}
|
|
17
19
|
</span>
|
|
20
|
+
{% if result.blob_url %}
|
|
21
|
+
<a href="{{ result.blob_url }}" class="badge rounded-pill bg-secondary">
|
|
22
|
+
file
|
|
23
|
+
</a>
|
|
24
|
+
{% endif %}
|
|
18
25
|
<span class="template-info-name">{{result.template_info.name}}</span>
|
|
19
26
|
{% if result.permission_url and display_edit_button %}
|
|
20
27
|
<input class="input-permission-url" type="hidden" value="{{result.permission_url}}">
|
|
21
|
-
<a class="permissions-link" href="#">
|
|
28
|
+
<a class="permissions-link-open mx-2" href="#" {% if BOOTSTRAP_VERSION == "4.6.2" %}data-toggle{% elif BOOTSTRAP_VERSION == "5.1.3"%}data-bs-toggle{% endif %}="tooltip" title="Open in text editor">
|
|
29
|
+
<i class="fas fa-code" aria-hidden="true"></i>
|
|
30
|
+
</a>
|
|
31
|
+
<a class="permissions-link mx-2" href="#" {% if BOOTSTRAP_VERSION == "4.6.2" %}data-toggle{% elif BOOTSTRAP_VERSION == "5.1.3"%}data-bs-toggle{% endif %}="tooltip" title="Edit">
|
|
22
32
|
<i class="fas fa-pencil-alt permissions-icon edit" aria-hidden="true"></i>
|
|
23
33
|
</a>
|
|
24
34
|
{% endif %}
|
|
25
35
|
<div title="Last modification date" class="data-info-right-container">
|
|
26
|
-
{{result.last_modification_date|json_date:"N d Y g:iA"}}
|
|
36
|
+
{{result.last_modification_date|parse_date|localtime|json_date:"N d Y g:iA"}}
|
|
27
37
|
</div>
|
|
28
38
|
</div>
|
|
29
39
|
</div>
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
<ul class="nav nav-tabs"role="tablist">
|
|
4
4
|
{% for data_source in query.data_sources %}
|
|
5
5
|
<li role="presentation" class="nav-item">
|
|
6
|
-
<a class="nav-link{% if forloop.counter0 == 0 %} active {% endif %}" href="#results_{{forloop.counter0}}" id="tab_results_{{forloop.counter0}}" aria-controls="profile" role="tab" data-toggle="tab">
|
|
6
|
+
<a class="nav-link{% if forloop.counter0 == 0 %} active {% endif %}" href="#results_{{forloop.counter0}}" id="tab_results_{{forloop.counter0}}" aria-controls="profile" role="tab" {% if BOOTSTRAP_VERSION == "4.6.2" %}data-toggle{% elif BOOTSTRAP_VERSION == "5.1.3" %}data-bs-toggle{% endif %}="tab">
|
|
7
7
|
From {{ data_source.name }}
|
|
8
|
-
<span class="badge badge-secondary" id="results_infos_{{forloop.counter0}}">-</span>
|
|
8
|
+
<span class="badge {% if BOOTSTRAP_VERSION == "4.6.2" %}badge-secondary{% elif BOOTSTRAP_VERSION == "5.1.3" %}bg-secondary{% endif %}" id="results_infos_{{forloop.counter0}}">-</span>
|
|
9
9
|
</a>
|
|
10
10
|
</li>
|
|
11
11
|
{% endfor %}
|
{core_explore_common_app-2.2.0 → core_explore_common_app-2.4.0}/core_explore_common_app/urls.py
RENAMED
|
@@ -23,12 +23,12 @@ urlpatterns = [
|
|
|
23
23
|
name="core_explore_common_data_sources_html",
|
|
24
24
|
),
|
|
25
25
|
re_path(
|
|
26
|
-
r"^data-source-results/(?P<query_id>\w+)/(?P<data_source_index>\w+)/(?P<page>\w+)",
|
|
26
|
+
r"^data-source-results/(?P<query_id>\w+)/(?P<data_source_index>\w+)/(?P<page>\w+)$",
|
|
27
27
|
user_ajax.get_data_source_results,
|
|
28
28
|
name="core_explore_common_data_source_results",
|
|
29
29
|
),
|
|
30
30
|
re_path(
|
|
31
|
-
r"^data-source-results/(?P<query_id>\w+)/(?P<data_source_index>\w+)",
|
|
31
|
+
r"^data-source-results/(?P<query_id>\w+)/(?P<data_source_index>\w+)$",
|
|
32
32
|
user_ajax.get_data_source_results,
|
|
33
33
|
name="core_explore_common_data_source_results",
|
|
34
34
|
),
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
""" Utils for PIDs
|
|
2
|
+
"""
|
|
3
|
+
from core_main_app.commons.exceptions import ApiError
|
|
4
|
+
from logging import getLogger
|
|
5
|
+
|
|
6
|
+
logger = getLogger(__name__)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def auto_set_pid_enabled(installed_apps):
|
|
10
|
+
"""Check if Auto Set Pid enabled
|
|
11
|
+
|
|
12
|
+
Returns:
|
|
13
|
+
|
|
14
|
+
"""
|
|
15
|
+
if "core_linked_records_app" in installed_apps:
|
|
16
|
+
from core_linked_records_app.components.pid_settings import (
|
|
17
|
+
api as pid_settings_api,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
return pid_settings_api.get().auto_set_pid
|
|
21
|
+
return False
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def get_pid_url(data, request):
|
|
25
|
+
"""Get pid url
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
data:
|
|
29
|
+
request:
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
|
|
33
|
+
"""
|
|
34
|
+
from core_linked_records_app.components.data import (
|
|
35
|
+
api as pid_data_api,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
try:
|
|
39
|
+
return pid_data_api.get_pid_for_data(data.id, request)
|
|
40
|
+
except ApiError as exc:
|
|
41
|
+
# If there is an error with the PID, fallback to regular data url
|
|
42
|
+
logger.warning(
|
|
43
|
+
"An error occurred while retrieving PID url: %s",
|
|
44
|
+
str(exc),
|
|
45
|
+
)
|
|
46
|
+
return None
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
""" Utils for the OAI-PMH protocol
|
|
2
|
+
"""
|
|
3
|
+
from django.conf import settings
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def is_oai_data_source(data_source):
|
|
7
|
+
"""Check if oai data source
|
|
8
|
+
|
|
9
|
+
Args:
|
|
10
|
+
data_source:
|
|
11
|
+
|
|
12
|
+
Returns:
|
|
13
|
+
|
|
14
|
+
"""
|
|
15
|
+
if (
|
|
16
|
+
"core_explore_oaipmh_app" in settings.INSTALLED_APPS
|
|
17
|
+
and "core_oaipmh_harvester_app" in settings.INSTALLED_APPS
|
|
18
|
+
):
|
|
19
|
+
from core_oaipmh_harvester_app.components.oai_registry import (
|
|
20
|
+
api as oai_registry_api,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
return data_source["name"] in oai_registry_api.get_all().values_list(
|
|
24
|
+
"name", flat=True
|
|
25
|
+
)
|
|
26
|
+
return False
|