ynput / ynput/ayon-python-api

AttributeError when setting limit argument in get_activities

Abierto Apto para principiantes
#351 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
Python
Estrellas
16
Forks
15
Merge medio
1 d 9 h
PR fusionados (30 d)
10

Descripción

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:

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza en ayon_api/_api_helpers/activities.py alrededor de la línea 99 y reproduce el problema con el script get_activities proporcionado usando limit=10. Rastrea por qué activities_field es None antes de que se llame a set_limit. Se considera terminado cuando get_activities acepta limit sin generar AttributeError y devuelve como máximo el número solicitado de actividades.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
api, backend
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Activo
Claridad
Bien especificado
Aptitud para principiantes
78/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.