TypeDAL 2.1.0b1__py3-none-any.whl → 2.1.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.

Potentially problematic release.


This version of TypeDAL might be problematic. Click here for more details.

typedal/__about__.py CHANGED
@@ -5,4 +5,4 @@ This file contains the Version info for this package.
5
5
  # SPDX-FileCopyrightText: 2023-present Robin van der Noord <robinvandernoord@gmail.com>
6
6
  #
7
7
  # SPDX-License-Identifier: MIT
8
- __version__ = "2.1.0-beta.1"
8
+ __version__ = "2.1.2"
typedal/core.py CHANGED
@@ -392,8 +392,18 @@ class TypeDAL(pydal.DAL): # type: ignore
392
392
  )
393
393
 
394
394
  if enable_typedal_caching:
395
- self.define(_TypedalCache, migrate=True)
396
- self.define(_TypedalCacheDependency, migrate=True)
395
+ self.try_define(_TypedalCache)
396
+ self.try_define(_TypedalCacheDependency)
397
+
398
+ def try_define(self, model: typing.Type[T]) -> typing.Type[T]:
399
+ """
400
+ Try to define a model with migrate or fall back to fake migrate.
401
+ """
402
+ try:
403
+ return self.define(model, migrate=True)
404
+ except Exception as e:
405
+ warnings.warn(f"{model} could not be migrated, try faking", source=e, category=RuntimeWarning)
406
+ return self.define(model, migrate=False, fake_migrate=True, redefine=True)
397
407
 
398
408
  default_kwargs: typing.ClassVar[typing.Dict[str, Any]] = {
399
409
  # fields are 'required' (notnull) by default:
typedal/for_py4web.py CHANGED
@@ -40,6 +40,7 @@ class AuthUser(TypedTable):
40
40
  """
41
41
  Class for db.auth_user in py4web (probably not w2p).
42
42
  """
43
+
43
44
  redefine = True
44
45
  migrate = False
45
46
 
@@ -52,6 +53,6 @@ class AuthUser(TypedTable):
52
53
  sso_id: Optional[str]
53
54
  action_token: Optional[str]
54
55
  last_password_change: Optional[datetime]
55
- past_passwords_hash: Optional[str]
56
- username: Optional[str]
57
- phone_number: Optional[str]
56
+ # past_passwords_hash: Optional[str]
57
+ # username: Optional[str]
58
+ # phone_number: Optional[str]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: TypeDAL
3
- Version: 2.1.0b1
3
+ Version: 2.1.2
4
4
  Summary: Typing support for PyDAL
5
5
  Project-URL: Documentation, https://github.com/trialandsuccess/TypeDAL#readme
6
6
  Project-URL: Issues, https://github.com/trialandsuccess/TypeDAL/issues
@@ -241,10 +241,6 @@ See [2. Defining Tables](docs/2_defining_tables.md)
241
241
 
242
242
  This section contains a non-exhaustive list of planned features for future feature releases:
243
243
 
244
- - 2.1
245
- - Caching: adding a `.cache()` operation to the query builder which loads a repeated execution from cache (via
246
- pickling of the final object). Optionally, dependency tracking could be added to automatically expire cache items
247
- when one of the underlying objects have changed in the database.
248
244
  - 2.2
249
245
  - Migrations: currently, you can use pydal's automatic migrations or disable those and manage them yourself, but
250
246
  adding something like [`edwh-migrate`](https://github.com/educationwarehouse/migrate#readme)
@@ -1,12 +1,12 @@
1
- typedal/__about__.py,sha256=hJJXow4iU5j5aWvmQ3XxQc0NZXGSWZhWLi_S-TiZ7z0,213
1
+ typedal/__about__.py,sha256=XIq50NymG7YOcrBFkUvu04Mbp2u9ABbGkAd5IxGHBCI,206
2
2
  typedal/__init__.py,sha256=QQpLiVl9w9hm2LBxey49Y_tCF_VB2bScVaS_mCjYy54,366
3
3
  typedal/caching.py,sha256=53WU5J_yRLygkKoDfD0rV_dkh5oqqT--64R9Mvz050Y,7457
4
- typedal/core.py,sha256=PEvy9xlR2ZtvxFwT7LDd5tTatWoGiIHLVbDatvOjKO8,91204
4
+ typedal/core.py,sha256=6iZHSE82Cj9S-YXeAJWvBEnks7rVE6AKxLjCP2kK94Y,91639
5
5
  typedal/fields.py,sha256=z2PD9vLWqBR_zXtiY0DthqTG4AeF3yxKoeuVfGXnSdg,5197
6
- typedal/for_py4web.py,sha256=HQTMy7Vfj_gu2jhrcF0KCmhMj203wITYwKjMi3uB0x4,1453
6
+ typedal/for_py4web.py,sha256=NN6GxZpp971HFxqiI5QZaNQYydsEvJh1TctxKuZE5pw,1460
7
7
  typedal/helpers.py,sha256=ZpHdwBMSANw-P9I5gs56Vf6GUbxGzFsIwbBvASKXX8s,6487
8
8
  typedal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  typedal/types.py,sha256=AADKhLbBotpDm5FM__fhvaRNGoHPjG-LcxflnjvhOz0,3011
10
- typedal-2.1.0b1.dist-info/METADATA,sha256=OvEDmtARST4kLF4fQYuYEPDQTIRmtCpdrLZNrIaUiIo,7742
11
- typedal-2.1.0b1.dist-info/WHEEL,sha256=KGYbc1zXlYddvwxnNty23BeaKzh7YuoSIvIMO4jEhvw,87
12
- typedal-2.1.0b1.dist-info/RECORD,,
10
+ typedal-2.1.2.dist-info/METADATA,sha256=nSrRdfHMqXOB5WEHpze57T_6uGY3QBuR5URRa1lvig8,7428
11
+ typedal-2.1.2.dist-info/WHEEL,sha256=KGYbc1zXlYddvwxnNty23BeaKzh7YuoSIvIMO4jEhvw,87
12
+ typedal-2.1.2.dist-info/RECORD,,