TimeField skips validators for timedelta values
Maintainer thường phản hồi trong vòng 4 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start by reading TimeField.to_db_value() in the field implementation and the existing validation tests. Reproduce the issue with the provided negative timedelta, then check that configured validators run and a valid timedelta is returned unchanged. The linked pull request #2405 is already open, so this work is underway.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
TimeField.to_db_value() returns timedelta values before calling the configured validators. These values are supported by the field and are returned by MySQL time columns.
from datetime import timedelta
from tortoise.fields import TimeField
from tortoise.exceptions import ValidationError
def reject_negative(value):
if value < timedelta():
raise ValidationError("negative time")
field = TimeField(validators=[reject_negative])
field.to_db_value(timedelta(hours=-1), object())
This returns the negative timedelta without raising on current develop. The field's normal validation path is skipped entirely for that type.
Removing the early return should let the existing validation call run while preserving the timedelta value. Reproduced directly on Python 3.14 without a database connection. A regression also checks that a valid timedelta is returned unchanged.
- Ngôn ngữ chính
- Python
- Star
- 5.6k
- Fork
- 543
- Merge trung bình
- 4 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 31
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của tortoise/tortoise-orm
-
Automatic DatetimeField values bypass custom validatorsCó thể đã có người làm @IlyaKhalafi đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
tortoise/tortoise-orm#2409 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
tortoise/tortoise-orm#668 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
UUIDField skips configured validators when writing valuesCó thể đã có người làm @IlyaKhalafi đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
tortoise/tortoise-orm#2407 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
tortoise/tortoise-orm#2406 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Email domain allowlists reject equivalent mixed-case domainsCó thể đã có người làm @IlyaKhalafi đã nhận 4 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
tortoise/tortoise-orm#2402 ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của tortoise/tortoise-orm
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 87/100
Maintainer thường phản hồi trong vòng 7 ngày
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
MTSWebServices/RecTools#330 ·
-
S9.7: Methodology pageĐang mởarea: web priority: P1 story
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
nfiasco/Quant-Time-Machine#151 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
autowarefoundation/autoware_carla_scenario#2019 ·
Maintainer thường phản hồi trong vòng 1 ngày