Skip to content

Commit fcc763c

Browse files
committed
fix(repository): match v2 baseline filter source in _handlers
The cherry-picked _handlers.py imported filter classes directly from the local _filters fallback to avoid self-triggering the deprecation warning. But v2 baseline behavior was to prefer advanced_alchemy.filters classes (with _filters as the AA-not-installed fallback). The change broke test_app_repository_signature_namespace which asserts the signature_namespace_values dict contains advanced_alchemy.filters classes. Restore the try/except pattern from upstream/v2:litestar/repository/ filters.py to keep the public class identity stable while still avoiding the deprecation warning trigger inside the internal handler.
1 parent b388831 commit fcc763c

1 file changed

Lines changed: 24 additions & 11 deletions

File tree

litestar/repository/_handlers.py

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
11
from typing import TYPE_CHECKING
22

3-
from litestar.repository._filters import (
4-
BeforeAfter,
5-
CollectionFilter,
6-
FilterTypes,
7-
LimitOffset,
8-
NotInCollectionFilter,
9-
NotInSearchFilter,
10-
OnBeforeAfter,
11-
OrderBy,
12-
SearchFilter,
13-
)
3+
try:
4+
from advanced_alchemy.filters import (
5+
BeforeAfter,
6+
CollectionFilter,
7+
FilterTypes,
8+
LimitOffset,
9+
NotInCollectionFilter,
10+
NotInSearchFilter,
11+
OnBeforeAfter,
12+
OrderBy,
13+
SearchFilter,
14+
)
15+
except ImportError: # pragma: no cover
16+
from litestar.repository._filters import ( # type: ignore[assignment]
17+
BeforeAfter,
18+
CollectionFilter,
19+
FilterTypes,
20+
LimitOffset,
21+
NotInCollectionFilter,
22+
NotInSearchFilter,
23+
OnBeforeAfter,
24+
OrderBy,
25+
SearchFilter,
26+
)
1427

1528
if TYPE_CHECKING:
1629
from litestar.config.app import AppConfig

0 commit comments

Comments
 (0)