-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Milestone
Description
With viur-core 3.8, an update_relations-Tasks fails at this call:
if not skel.patch(lambda skel: skel.refresh(), key=src_rel["src"].key, update_relations=False):
logging.warning(f"Cannot update stale reference to {src_rel["src"].key!r} referenced by {src_rel.key!r}")With this error:
Creation during update is forbidden - explicitly provide `create=True` to allow.
Traceback (most recent call last):
File "/layers/google.python.pip/pip/lib/python3.13/site-packages/viur/core/tasks.py", line 246, in deferred
_deferred_tasks[funcPath](*args, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.13/site-packages/viur/core/skeleton/tasks.py", line 90, in update_relations
if not skel.patch(lambda skel: skel.refresh(), key=src_rel["src"].key, update_relations=False):
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.13/site-packages/viur/core/skeleton/skeleton.py", line 806, in patch
return db.run_in_transaction(__update_txn)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.13/site-packages/viur/core/db/transport.py", line 123, in run_in_transaction
res = func(*args, **kwargs)
File "/layers/google.python.pip/pip/lib/python3.13/site-packages/viur/core/skeleton/skeleton.py", line 755, in __update_txn
raise ValueError("Creation during update is forbidden - explicitly provide `create=True` to allow.")
ValueError: Creation during update is forbidden - explicitly provide `create=True` to allow.
Solution for this problem would be
try:
skel.patch(lambda skel: skel.refresh(), key=src_rel["src"].key, update_relations=False)
except ValueError:
logging.warning(f"Cannot update stale reference to {src_rel["src"].key!r} referenced by {src_rel.key!r}")But IMHO, the original handling of the function shown above is more likely to Skeleton.read(), with create=False.
Reactions are currently unavailable