TypeDAL 3.9.0__py3-none-any.whl → 3.9.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- typedal/__about__.py +1 -1
- typedal/core.py +12 -2
- typedal/for_py4web.py +19 -1
- {typedal-3.9.0.dist-info → typedal-3.9.2.dist-info}/METADATA +1 -2
- {typedal-3.9.0.dist-info → typedal-3.9.2.dist-info}/RECORD +7 -7
- {typedal-3.9.0.dist-info → typedal-3.9.2.dist-info}/WHEEL +0 -0
- {typedal-3.9.0.dist-info → typedal-3.9.2.dist-info}/entry_points.txt +0 -0
typedal/__about__.py
CHANGED
typedal/core.py
CHANGED
|
@@ -2230,9 +2230,19 @@ class QueryBuilder(typing.Generic[T_MetaInstance]):
|
|
|
2230
2230
|
|
|
2231
2231
|
def __bool__(self) -> bool:
|
|
2232
2232
|
"""
|
|
2233
|
-
Querybuilder is truthy if it has
|
|
2233
|
+
Querybuilder is truthy if it has any conditions.
|
|
2234
2234
|
"""
|
|
2235
|
-
|
|
2235
|
+
table = self.model._ensure_table_defined()
|
|
2236
|
+
default_query = typing.cast(Query, table.id > 0)
|
|
2237
|
+
return any(
|
|
2238
|
+
[
|
|
2239
|
+
self.query != default_query,
|
|
2240
|
+
self.select_args,
|
|
2241
|
+
self.select_kwargs,
|
|
2242
|
+
self.relationships,
|
|
2243
|
+
self.metadata,
|
|
2244
|
+
]
|
|
2245
|
+
)
|
|
2236
2246
|
|
|
2237
2247
|
def _extend(
|
|
2238
2248
|
self,
|
typedal/for_py4web.py
CHANGED
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
ONLY USE IN COMBINATION WITH PY4WEB!
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
+
import typing
|
|
6
|
+
|
|
5
7
|
import threadsafevariable
|
|
8
|
+
from configuraptor.abs import AnyType
|
|
6
9
|
from py4web.core import ICECUBE
|
|
7
10
|
from py4web.core import Fixture as _Fixture
|
|
11
|
+
from pydal.base import MetaDAL, hashlib_md5
|
|
8
12
|
|
|
9
13
|
from .core import TypeDAL
|
|
10
14
|
from .types import AnyDict
|
|
@@ -17,7 +21,21 @@ class Fixture(_Fixture): # type: ignore
|
|
|
17
21
|
"""
|
|
18
22
|
|
|
19
23
|
|
|
20
|
-
class
|
|
24
|
+
class PY4WEB_DAL_SINGLETON(MetaDAL):
|
|
25
|
+
_instances: typing.ClassVar[typing.MutableMapping[str, AnyType]] = {}
|
|
26
|
+
|
|
27
|
+
def __call__(cls, uri: str, *args: typing.Any, **kwargs: typing.Any) -> AnyType:
|
|
28
|
+
db_uid = kwargs.get("db_uid", hashlib_md5(repr(uri)).hexdigest())
|
|
29
|
+
if db_uid not in cls._instances:
|
|
30
|
+
cls._instances[db_uid] = super().__call__(*args, **kwargs)
|
|
31
|
+
|
|
32
|
+
return cls._instances[db_uid]
|
|
33
|
+
|
|
34
|
+
def _clear(cls) -> None:
|
|
35
|
+
cls._instances.clear()
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class DAL(TypeDAL, Fixture, metaclass=PY4WEB_DAL_SINGLETON): # pragma: no cover
|
|
21
39
|
"""
|
|
22
40
|
Fixture similar to the py4web pydal fixture, but for typedal.
|
|
23
41
|
"""
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: TypeDAL
|
|
3
|
-
Version: 3.9.
|
|
3
|
+
Version: 3.9.2
|
|
4
4
|
Summary: Typing support for PyDAL
|
|
5
5
|
Project-URL: Documentation, https://typedal.readthedocs.io/
|
|
6
6
|
Project-URL: Issues, https://github.com/trialandsuccess/TypeDAL/issues
|
|
7
7
|
Project-URL: Source, https://github.com/trialandsuccess/TypeDAL
|
|
8
8
|
Author-email: Robin van der Noord <contact@trialandsuccess.nl>
|
|
9
|
-
License-Expression: MIT
|
|
10
9
|
Classifier: Development Status :: 4 - Beta
|
|
11
10
|
Classifier: Programming Language :: Python
|
|
12
11
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
typedal/__about__.py,sha256=
|
|
1
|
+
typedal/__about__.py,sha256=HjOL8WWOSXGjZPI6ywVgMyu8Zpp8670DqkRZsl5aZzs,206
|
|
2
2
|
typedal/__init__.py,sha256=QQpLiVl9w9hm2LBxey49Y_tCF_VB2bScVaS_mCjYy54,366
|
|
3
3
|
typedal/caching.py,sha256=SMcJsahLlZ79yykWCveERFx1ZJUNEKhA9SPmCTIuLp8,11798
|
|
4
4
|
typedal/cli.py,sha256=wzyId6YwRyqfuJ2byxvl6YecDNaKpkLmo-R5HvRuTok,19265
|
|
5
5
|
typedal/config.py,sha256=0qy1zrTUdtmXPM9jHzFnSR1DJsqGJqcdG6pvhzKQHe0,11625
|
|
6
|
-
typedal/core.py,sha256=
|
|
6
|
+
typedal/core.py,sha256=OBokUmNBvm83REIEKUjjIXna5UWSXC5H8M82LiAag0M,102729
|
|
7
7
|
typedal/fields.py,sha256=A4qt0aK4F_-UeOY-xJ0ObVY-tFEoLFy7TYRMHnp4g6o,6516
|
|
8
|
-
typedal/for_py4web.py,sha256=
|
|
8
|
+
typedal/for_py4web.py,sha256=YmGkbJ620zvGqdSmN2U0BmvdujZo_HI7-mUIVmvSvBw,1899
|
|
9
9
|
typedal/for_web2py.py,sha256=xn7zo6ImsmTkH6LacbjLQl2oqyBvP0zLqRxEJvMQk1w,1929
|
|
10
10
|
typedal/helpers.py,sha256=uej96exzJ9qVBd6LudP8uJ_7Cmq6vKraerdKvSRBVjc,8128
|
|
11
11
|
typedal/mixins.py,sha256=6QfeVBAk7J4uHSR82Ek_Bhq43hzxnrmLn6xqxZqYtMk,5757
|
|
@@ -13,7 +13,7 @@ typedal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
13
13
|
typedal/types.py,sha256=1FIgv1s0be0E8r5Wd9E1nvDvK4ETV8u2NlfI7_P6UUY,6752
|
|
14
14
|
typedal/web2py_py4web_shared.py,sha256=VK9T8P5UwVLvfNBsY4q79ANcABv-jX76YKADt1Zz_co,1539
|
|
15
15
|
typedal/serializers/as_json.py,sha256=ffo152W-sARYXym4BzwX709rrO2-QwKk2KunWY8RNl4,2229
|
|
16
|
-
typedal-3.9.
|
|
17
|
-
typedal-3.9.
|
|
18
|
-
typedal-3.9.
|
|
19
|
-
typedal-3.9.
|
|
16
|
+
typedal-3.9.2.dist-info/METADATA,sha256=fzTJVyf4WHOP0UABFFXPlLzV_fiHzOOiUpSYZFeCtQE,10439
|
|
17
|
+
typedal-3.9.2.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
18
|
+
typedal-3.9.2.dist-info/entry_points.txt,sha256=m1wqcc_10rHWPdlQ71zEkmJDADUAnZtn7Jac_6mbyUc,44
|
|
19
|
+
typedal-3.9.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|