fix: Limit getattr to lazy loaded child tables only
This commit is contained in:
parent
5c886ef091
commit
10c3c9ea9b
1 changed files with 3 additions and 4 deletions
|
|
@ -9,7 +9,7 @@ from collections.abc import Generator, Iterable
|
|||
from contextlib import contextmanager
|
||||
from functools import wraps
|
||||
from types import MappingProxyType
|
||||
from typing import TYPE_CHECKING, Any, Literal, Optional, TypeAlias, Union, cast, overload
|
||||
from typing import TYPE_CHECKING, Any, Literal, Optional, TypeAlias, Union, overload
|
||||
|
||||
from typing_extensions import Self, override
|
||||
from werkzeug.exceptions import NotFound
|
||||
|
|
@ -1983,11 +1983,10 @@ class LazyDocument:
|
|||
|
||||
@override
|
||||
def get(self: Document, key, filters=None, limit=None, default=None):
|
||||
if isinstance(key, str):
|
||||
if isinstance(key, str) and key in self._table_fieldnames:
|
||||
# Trigger populating of __dict__
|
||||
getattr(self, key, None)
|
||||
parent = cast(Document, super())
|
||||
return parent.get(key, filters, limit, default)
|
||||
return super().get(key, filters, limit, default)
|
||||
|
||||
@override
|
||||
def db_update_all(self):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue