Heya!
So this was tested with both gazu 0.10.31 and 1.1.3 (not a regression)
The issue being that according to how the preview record is returned from gazu.
It doesn't contain the same information, hence the inconsistency.
In the following case, code shared below.
When the preview record is returned after creation, it's missing the "comments" key altogether.
When the record is re-queried, instantly from its id, is has an extra "comments" key, and that key is populated by a list of strings.
Which means any function validating or interacting with previews, would need to evaluate this inconsistency first then re-query the DB in the former case.
>>> import gazu
# TODO: Set to host + login.
# TODO: Change for your ids + path.
>>> task_id = "e1e020e0-9c7e-4406-b2fd-79267e98bff7"
>>> task_status_id = "3bba952c-7a61-45d0-a1ca-dd26bf395efb"
>>> file_path = "/path/to/file.jpg"
>>> comment, preview = gazu.task.publish_preview(
... task=task_id,
... task_status=task_status_id,
... preview_file_path=file_path,
... )
>>> updated_preview = gazu.files.get_preview_file(preview["id"])
>>> updated_preview["id"] == preview["id"]
True
>>> updated_preview == preview
False
>>> len(preview.keys())
28
>>> len(updated_preview.keys())
29
>>> preview["comments"]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: 'comments'
>>> updated_preview["comments"]
['029c791a-f5d2-4003-a9ec-a4a5a1355159']
Heya!
So this was tested with both gazu 0.10.31 and 1.1.3 (not a regression)
The issue being that according to how the preview record is returned from gazu.
It doesn't contain the same information, hence the inconsistency.
In the following case, code shared below.
When the preview record is returned after creation, it's missing the "comments" key altogether.
When the record is re-queried, instantly from its id, is has an extra "comments" key, and that key is populated by a list of strings.
Which means any function validating or interacting with previews, would need to evaluate this inconsistency first then re-query the DB in the former case.