Skip to content

Commit 7005b69

Browse files
njkimchiatt
authored andcommitted
nit, #10426
1 parent 6a2d353 commit 7005b69

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

arches/app/datatypes/datatypes.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1481,7 +1481,11 @@ def transform_value_for_tile(self, value, **kwargs):
14811481
tile_file[key] = {}
14821482
val = file_info.get(key, "")
14831483
for lang in languages:
1484-
metadata_value = val if isinstance(val, str) else val.get(lang.code, {}).get("value", "")
1484+
metadata_value = (
1485+
val
1486+
if isinstance(val, str)
1487+
else val.get(lang.code, {}).get("value", "")
1488+
)
14851489
tile_file[key][lang.code] = {
14861490
"value": metadata_value,
14871491
"direction": lang.default_direction,

arches/app/utils/string_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def get_str_kwarg_as_bool(
2424
def deserialize_json_like_string(val, depth=2):
2525
"""
2626
Takes string intended as JSON that cannot be deserialized to a dictionary by `json.loads`
27-
and returns a dictionary. If a string uses single quotes around keys and values
27+
and returns a dictionary. If a string uses single quotes around keys and values
2828
e.g. "{'foo':'bar'}", these are converted to double quotes. If a string has escaped
2929
quotes e.g. "[{\\"foo\\":\\"bar\\"}]", these are recursively deserialized until `json.loads`
3030
returns a dictionary. This function serves as a more secure alternative to `ast.literal_eval`.

tests/utils/datatypes/filelist_datatype_tests.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ def test_tile_transform(self):
2323
"name": "testfile4.png",
2424
"altText": {"en": {"value": "Test File 4", "direction": "ltr"}},
2525
"attribution": {"en": {"value": "archesproject", "direction": "ltr"}},
26-
"description": {"en": {"value": "A File for Testing", "direction": "ltr"}},
26+
"description": {
27+
"en": {"value": "A File for Testing", "direction": "ltr"}
28+
},
2729
"title": {"en": {"value": "Test File 4", "direction": "ltr"}},
2830
},
2931
]

0 commit comments

Comments
 (0)