das-cli 1.6.6__tar.gz → 1.6.7__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.
- {das_cli-1.6.6/das_cli.egg-info → das_cli-1.6.7}/PKG-INFO +5 -5
- {das_cli-1.6.6 → das_cli-1.6.7}/README.md +4 -4
- {das_cli-1.6.6 → das_cli-1.6.7}/das/managers/entries_manager.py +41 -29
- {das_cli-1.6.6 → das_cli-1.6.7/das_cli.egg-info}/PKG-INFO +5 -5
- {das_cli-1.6.6 → das_cli-1.6.7}/pyproject.toml +1 -1
- {das_cli-1.6.6 → das_cli-1.6.7}/LICENSE +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/MANIFEST.in +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/__init__.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/ai/plugins/dasai.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/ai/plugins/entries/entries_plugin.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/app.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/authentication/auth.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/authentication/oauth.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/authentication/secure_input.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/cli.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/common/api.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/common/config.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/common/entry_fields_constants.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/common/enums.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/common/errors.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/common/exceptions.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/common/file_utils.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/managers/__init__.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/managers/digital_objects_manager.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/managers/download_manager.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/managers/search_manager.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/services/attributes.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/services/cache.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/services/das_elastic_search.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/services/digital_objects.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/services/downloads.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/services/entries.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/services/entry_fields.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/services/hangfire.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/services/search.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/services/service_base.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das/services/users.py +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das_cli.egg-info/SOURCES.txt +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das_cli.egg-info/dependency_links.txt +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das_cli.egg-info/entry_points.txt +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das_cli.egg-info/requires.txt +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/das_cli.egg-info/top_level.txt +0 -0
- {das_cli-1.6.6 → das_cli-1.6.7}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: das-cli
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.7
|
|
4
4
|
Summary: DAS api client.
|
|
5
5
|
Author: Royal Netherlands Institute for Sea Research
|
|
6
6
|
License-Expression: MIT
|
|
@@ -362,10 +362,10 @@ entry = entries.get(id="6b0e68e6-00cd-43a7-9c51-d56c9c091123")
|
|
|
362
362
|
entry = entries.get_entry("6b0e68e6-00cd-43a7-9c51-d56c9c091123")
|
|
363
363
|
```
|
|
364
364
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
365
|
+
Digital objects are always included, under the single key `"Digital Object(s)"`
|
|
366
|
+
— regardless of what the attribute calls its digital-object field (Persons
|
|
367
|
+
calls it *Files*) and even when the entry-field metadata does not expose the
|
|
368
|
+
field at all:
|
|
369
369
|
|
|
370
370
|
```python
|
|
371
371
|
for obj in entry.get("Digital Object(s)", []):
|
|
@@ -339,10 +339,10 @@ entry = entries.get(id="6b0e68e6-00cd-43a7-9c51-d56c9c091123")
|
|
|
339
339
|
entry = entries.get_entry("6b0e68e6-00cd-43a7-9c51-d56c9c091123")
|
|
340
340
|
```
|
|
341
341
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
342
|
+
Digital objects are always included, under the single key `"Digital Object(s)"`
|
|
343
|
+
— regardless of what the attribute calls its digital-object field (Persons
|
|
344
|
+
calls it *Files*) and even when the entry-field metadata does not expose the
|
|
345
|
+
field at all:
|
|
346
346
|
|
|
347
347
|
```python
|
|
348
348
|
for obj in entry.get("Digital Object(s)", []):
|
|
@@ -49,8 +49,8 @@ def _safe_lower(value) -> str:
|
|
|
49
49
|
return str(value).lower()
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
#
|
|
53
|
-
#
|
|
52
|
+
# The single key digital objects are published under, whatever the attribute
|
|
53
|
+
# calls its digital-object field (Persons calls it "Files").
|
|
54
54
|
DIGITAL_OBJECTS_KEY = "Digital Object(s)"
|
|
55
55
|
|
|
56
56
|
# Keys only a digital-object payload carries. Select/relation attributes are
|
|
@@ -716,24 +716,30 @@ class EntryManager:
|
|
|
716
716
|
return [_normalize_digital_object(obj) for obj in data if isinstance(obj, dict)]
|
|
717
717
|
|
|
718
718
|
def __attach_digital_objects(self, entry, entry_raw, field_items):
|
|
719
|
-
"""
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
719
|
+
"""Expose an entry's digital objects under one canonical key.
|
|
720
|
+
|
|
721
|
+
Two things make this necessary:
|
|
722
|
+
|
|
723
|
+
* The display name is not stable per attribute - Persons calls its
|
|
724
|
+
digital-object field "Files", every other attribute calls it
|
|
725
|
+
"Digital Object(s)" - so callers would have to know the label.
|
|
726
|
+
Keeping the label would also make a ``get`` -> ``update`` round trip
|
|
727
|
+
write the normalized list back into the raw column, because
|
|
728
|
+
:meth:`update` maps caller keys by display name.
|
|
729
|
+
* The backend returns digital objects under the *attribute id* of the
|
|
730
|
+
digital-object attribute (e.g. ``"6"``), which is not always present
|
|
731
|
+
in the entry-field metadata - so mapped fields alone can miss them.
|
|
732
|
+
|
|
733
|
+
So: drop whatever the attribute calls the field, scan the raw payload,
|
|
734
|
+
and publish everything under ``DIGITAL_OBJECTS_KEY``.
|
|
726
735
|
"""
|
|
727
736
|
digital_objects = []
|
|
728
737
|
seen_ids = set()
|
|
729
738
|
|
|
730
|
-
|
|
731
|
-
objects
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
continue
|
|
735
|
-
|
|
736
|
-
for obj in objects:
|
|
739
|
+
def collect(objects):
|
|
740
|
+
for obj in objects or []:
|
|
741
|
+
if not isinstance(obj, dict):
|
|
742
|
+
continue
|
|
737
743
|
identifier = obj.get("Id")
|
|
738
744
|
if identifier is not None:
|
|
739
745
|
if identifier in seen_ids:
|
|
@@ -741,24 +747,30 @@ class EntryManager:
|
|
|
741
747
|
seen_ids.add(identifier)
|
|
742
748
|
digital_objects.append(obj)
|
|
743
749
|
|
|
744
|
-
|
|
745
|
-
return
|
|
746
|
-
|
|
747
|
-
target_key = DIGITAL_OBJECTS_KEY
|
|
750
|
+
has_digital_object_field = False
|
|
748
751
|
|
|
752
|
+
# Values the field loop already mapped, under the attribute's own label.
|
|
749
753
|
for field in field_items:
|
|
750
|
-
if field.get('inputType')
|
|
751
|
-
|
|
752
|
-
|
|
754
|
+
if field.get('inputType') != DIGITAL_OBJECT_INPUT:
|
|
755
|
+
continue
|
|
756
|
+
|
|
757
|
+
has_digital_object_field = True
|
|
758
|
+
field_name = field.get('displayName')
|
|
759
|
+
|
|
760
|
+
if not field_name:
|
|
761
|
+
continue
|
|
762
|
+
|
|
763
|
+
mapped = entry.pop(field_name, None) if field_name != DIGITAL_OBJECTS_KEY else entry.get(field_name)
|
|
753
764
|
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
existing = entry.get(target_key)
|
|
765
|
+
if isinstance(mapped, list):
|
|
766
|
+
collect(mapped)
|
|
757
767
|
|
|
758
|
-
|
|
759
|
-
|
|
768
|
+
# Plus anything the entry-field metadata does not expose as a field.
|
|
769
|
+
for value in entry_raw.values():
|
|
770
|
+
collect(_parse_digital_objects(value))
|
|
760
771
|
|
|
761
|
-
|
|
772
|
+
if digital_objects or has_digital_object_field:
|
|
773
|
+
entry[DIGITAL_OBJECTS_KEY] = digital_objects
|
|
762
774
|
|
|
763
775
|
|
|
764
776
|
def __create_from_json_file(self, attribute: str, file_path: str):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: das-cli
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.7
|
|
4
4
|
Summary: DAS api client.
|
|
5
5
|
Author: Royal Netherlands Institute for Sea Research
|
|
6
6
|
License-Expression: MIT
|
|
@@ -362,10 +362,10 @@ entry = entries.get(id="6b0e68e6-00cd-43a7-9c51-d56c9c091123")
|
|
|
362
362
|
entry = entries.get_entry("6b0e68e6-00cd-43a7-9c51-d56c9c091123")
|
|
363
363
|
```
|
|
364
364
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
365
|
+
Digital objects are always included, under the single key `"Digital Object(s)"`
|
|
366
|
+
— regardless of what the attribute calls its digital-object field (Persons
|
|
367
|
+
calls it *Files*) and even when the entry-field metadata does not expose the
|
|
368
|
+
field at all:
|
|
369
369
|
|
|
370
370
|
```python
|
|
371
371
|
for obj in entry.get("Digital Object(s)", []):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|