Skip to content

Add is_for_all argument in gazu.playlist.new_playlist? #387

@hww-clementpoulain

Description

@hww-clementpoulain

Heya!

Undecided if this is an enhancement request or a bug..
Probably just a enhancement request when the linked bug is fixed.

Currently, when creating a new playlist from gazu with episode=None.
It places that playlist under the "Main Pack" episode dropdown in web.
The playlist then needs to be updated with is_for_all=True in order to be placed under the "All Assets" dropdown in web.

It would save an extra DB write to be able to set that straight away.
The main issue is that right now this extra DB write cannot be done in itself because of the issue: #386

So instea,d 2 workarounds must now be implemented in order to have this playlist under the "All Assets" episode dropdown. As per the following code example:

>>> import gazu

# TODO: Set to host + login.
# TODO: Change for your IDs.

>>> project_id = "4e18db64-2703-4b18-9f87-62d114080df7"

>>> playlist = gazu.playlist.new_playlist(
...     project=project_id,
...     name="my_playlist_test2",
...     episode=None,
...     for_entity="asset",
...     for_client=False,
... )  # Empty playlist created under "main pack" Episode dropdown.

# Attempt No1 of the playlist location work around:
>>> playlist["is_for_all"] = True
>>> playlist = gazu.playlist.update_playlist(playlist)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/hwwdev/rez/cache/clementpoulain/gazu/1.1.3.m1/93a1/a/python/gazu/playlist.py", line 163, in update_playlist
    return raw.put(f"data/playlists/{playlist['id']}", playlist, client=client)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hwwdev/rez/cache/clementpoulain/gazu/1.1.3.m1/93a1/a/python/gazu/client.py", line 443, in put
    _, retry = check_status(response, path, client=client)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hwwdev/rez/cache/clementpoulain/gazu/1.1.3.m1/93a1/a/python/gazu/client.py", line 533, in check_status
    raise ParameterException(path, get_message_from_response(request))
gazu.exception.ParameterException: ('data/playlists/28f3f209-1e60-494f-acca-9631351da189', "'NoneType' object is not iterable")

# Attempt No2 of the playlist location work around:
>>> playlist["shots"]= []
>>> playlist = gazu.playlist.update_playlist(playlist)  # The playlist is now successfully under "All Assets"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions