ynput / ynput/ayon-python-api

AttributeError when setting limit argument in get_activities

Offen Anfängerfreundlich
#351 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Python
Sterne
16
Forks
15
Ø Merge
1 T. 9 Std.
Gemergte PRs (30 T.)
10

Beschreibung

Is there an existing issue for this?
  • I have searched the existing issues and added correct labels.
Description

Current Behavior

Specifying the limit argument when calling get_activities, will raise the following error :

Traceback (most recent call last):
  File "<string>", line 8, in <module>
  File "C:\Users\user\AppData\Local\Ynput\AYON\app\AYON 1.6.3\dependencies\ayon_api\_api_helpers\activities.py", line 99, in get_activities
    activities_field.set_limit(limit)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'set_limit'

Expected Behavior

It should be possible to set the limit argument.

Steps To Reproduce:

Here is a small script that you can run in the AYON launcher console or with ayon_api directly with the right env vars set up. By running it you'll get the aforementioned error.

from ayon_api import get_activities

activities = get_activities(
    project_name="projectname",
    limit=10
)

for activity in activities:
    print(activity)

Removing limit from this script and calling get_activities with project_name only will work (but be careful as it'll likely query all activities!).

Additional context:
Version

Server : 1.15.17
Launcher : 1.4.2 and 1.6.3
ayon-python-api : 1.2.4, 1.2.22 and 1.2.23

What platform were you running when you found the bug?

Windows

Relevant log output:

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne in ayon_api/_api_helpers/activities.py bei Zeile 99 und reproduziere das Problem mit dem bereitgestellten get_activities-Skript unter Verwendung von limit=10. Verfolge, warum activities_field None ist, bevor set_limit aufgerufen wird. Fertig ist die Aufgabe, wenn get_activities limit akzeptiert, ohne AttributeError auszulösen, und nicht mehr als die angeforderte Anzahl von Aktivitäten zurückgibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
api, backend
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Aktiv
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
78/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.