TimeField skips validators for timedelta values
メンテナーはふだん 2 日以内に返信
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 5.6k
- フォーク
- 540
- 平均マージ
- 4日 4時間
- マージ済み PR(30日)
- 32
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
tortoise/tortoise-orm のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
tortoise/tortoise-orm#668 ·
メンテナーはふだん 2 日以内に返信
-
UUIDField skips configured validators when writing values対応中かも @IlyaKhalafi が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
tortoise/tortoise-orm#2407 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
tortoise/tortoise-orm#2406 ·
メンテナーはふだん 2 日以内に返信
-
Email domain allowlists reject equivalent mixed-case domains対応中かも @IlyaKhalafi が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
tortoise/tortoise-orm#2402 ·
メンテナーはふだん 2 日以内に返信
-
in_transaction() leaks a pool connection when begin() is cancelled対応中かも @inchang-ing が 4 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
tortoise/tortoise-orm#2391 ·
メンテナーはふだん 2 日以内に返信
tortoise/tortoise-orm の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
SpikeInterface/spikeinterface#4924 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
aws-samples/sample-per-model-bedrock#782 ·
メンテナーはふだん 1 日以内に返信
-
bug javascript
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
No-op PreToolUse:Bash hook (bash_hook.py) still registered synchronously; adds latency and can time out at 10 s対応中かも @alexgr-agent が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
alexgreensh/token-optimizer#313 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100