Skip to content

Commit

Permalink
fix: FileBone.postSaveHandler iterates over None (#1350)
Browse files Browse the repository at this point in the history
An empty multi-lang `FileBone` has `None` values

```py
 Traceback (most recent call last):
  File "/layers/google.python.pip/pip/lib/python3.11/site-packages/viur/toolkit/importer/importable.py", line 616, in _convert_entry
    assert skel.toDB(update_relations=updateRelations)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/layers/google.python.pip/pip/lib/python3.11/site-packages/viur/core/skeleton.py", line 1193, in toDB
    bone.postSavedHandler(skel, bone_name, key)
  File "/layers/google.python.pip/pip/lib/python3.11/site-packages/viur/core/bones/file.py", line 224, in postSavedHandler
    handleDerives(values[lang])
  File "/layers/google.python.pip/pip/lib/python3.11/site-packages/viur/core/bones/file.py", line 217, in handleDerives
    for val in values:  # Ensure derives getting build for each file referenced in this relation
TypeError: 'NoneType' object is not iterable
```
  • Loading branch information
sveneberth authored Dec 12, 2024
1 parent 37dc0ac commit c634c07
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/viur/core/bones/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def postSavedHandler(self, skel, boneName, key):
def handleDerives(values):
if isinstance(values, dict):
values = [values]
for val in values: # Ensure derives getting build for each file referenced in this relation
for val in (values or ()): # Ensure derives getting build for each file referenced in this relation
ensureDerived(val["dest"]["key"], f"{skel.kindName}_{boneName}", self.derive)

values = skel[boneName]
Expand Down

0 comments on commit c634c07

Please sign in to comment.