ynput / ynput/ayon-python-api

AttributeError when setting limit argument in get_activities

Đang mở Phù hợp với người mới
#351 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Python
Star
16
Fork
15
Merge trung bình
1 ngày 9 giờ
Pull request đã merge (30 ngày)
10

Mô tả

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:

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu trong ayon_api/_api_helpers/activities.py, quanh dòng 99, và tái hiện vấn đề bằng script get_activities được cung cấp với limit=10. Truy tìm lý do activities_field là None trước khi set_limit được gọi. Hoàn tất khi get_activities chấp nhận limit mà không phát sinh AttributeError và trả về không quá số lượng activity được yêu cầu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
api, backend
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
78/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.