kisa-utils 0.37.20__py3-none-any.whl → 0.38.0__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.
kisa_utils/db.py CHANGED
@@ -955,11 +955,10 @@ class Api:
955
955
  reply['log'] = 'database not open'
956
956
  return reply if not self.__returnKISAResponse else Error(reply['log'])
957
957
 
958
- if self.__withContextCount > 1:
958
+ if not self.inTopLevelContext:
959
959
  reply['log'] = 'can not commit transaction in non top-level context'
960
960
  return reply if not self.__returnKISAResponse else Error(reply['log'])
961
961
 
962
-
963
962
  for op in self.__transactionData:
964
963
  if self.__transactionData[op]['failed']:
965
964
  reply['log'] = f'{self.__transactionData[op]["failed"]} `{op}` operation(s) returned a `False` status'
@@ -1103,6 +1102,14 @@ class Api:
1103
1102
  def __bool__(self)->bool:
1104
1103
  return self.isOpen
1105
1104
 
1105
+ @property
1106
+ def inTopLevelContext(self) -> bool:
1107
+ '''
1108
+ check if the opened db-handle is in the top-most `with` context.
1109
+ If it is, then its okay to commit a transaction
1110
+ '''
1111
+ return self.__withContextCount <= 1
1112
+
1106
1113
  Handle = Api
1107
1114
 
1108
1115
  def transaction(*dbArgs, **dbKwargs) -> dict|Response:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kisa-utils
3
- Version: 0.37.20
3
+ Version: 0.38.0
4
4
  Summary: Utility functions and modules for KISA Developers
5
5
  Author: Tom Bukenya
6
6
  Author-email: glayn2bukman@gmail.com
@@ -3,7 +3,7 @@ kisa_utils/cache.py,sha256=4Ue5G3QhHSQAmIfQKYgWKWjNL4rA4wLLd_RdBLb2ABY,7345
3
3
  kisa_utils/codes.py,sha256=PV_S53Skggf4XetOdYoIKtEmM8cpN5wZwUlxje70WZY,904
4
4
  kisa_utils/config.py,sha256=NfluzGKTh66qfNtC-Ae0zNb1XzMTgU2Me9Vi82R9c1E,2285
5
5
  kisa_utils/dates.py,sha256=kcNqoY_iguG9hSzABMIBqeL3MGz3n4MRIXuW4OxRHLs,12662
6
- kisa_utils/db.py,sha256=QH9nvwc3Lr-NyUA-47Rae-s2xeMIE6m2rNGozcpr2jg,48950
6
+ kisa_utils/db.py,sha256=tVNMV-hc-oPxR4iRSX-d82Gi4fQwI5Cga1eP8SLvHFs,49202
7
7
  kisa_utils/encryption.py,sha256=nFzNpzWV_D9uSEq4FsgCnlS7FQtqWP9fvM_81rsfcLo,4218
8
8
  kisa_utils/enqueue.py,sha256=VIliaMvw4MUdOqts0dXdZCYNxs-QrOVjIRAR3scGrRM,11786
9
9
  kisa_utils/figures.py,sha256=pYIpQzu1OXRSsY1d98GhgPifnIRmgl-r7S32ai-Ms0c,3731
@@ -23,7 +23,7 @@ kisa_utils/servers/flask.py,sha256=o76cJKlQ3L8EOVdHUF092qwoAZMzgttuLt0mMhtCsGI,4
23
23
  kisa_utils/structures/__init__.py,sha256=JBU1j3A42jQ62ALKnsS1Hav9YXcYwjDw1wQJtohXPbU,83
24
24
  kisa_utils/structures/utils.py,sha256=665rXIapGwFqejizeJwy3DryeskCQOdgP25BCdLkGvk,2898
25
25
  kisa_utils/structures/validator.py,sha256=Y4UmB4TH7N-GkK22EV1WOsPWjTeqxVWLTentl1keZD4,4053
26
- kisa_utils-0.37.20.dist-info/METADATA,sha256=01cNCPOuqmY6hTmZ3KYeOqf3XkVDSi8GyvQRdyigNSY,478
27
- kisa_utils-0.37.20.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
28
- kisa_utils-0.37.20.dist-info/top_level.txt,sha256=URxY4sRuqmirOxWtztpVmPoGQdksEMYO6hmYsEDGz2Y,75
29
- kisa_utils-0.37.20.dist-info/RECORD,,
26
+ kisa_utils-0.38.0.dist-info/METADATA,sha256=N9Rr0nesf9HuUFeg9N_nQgpZYO5YLOMhfOYax5vI3NA,477
27
+ kisa_utils-0.38.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
28
+ kisa_utils-0.38.0.dist-info/top_level.txt,sha256=URxY4sRuqmirOxWtztpVmPoGQdksEMYO6hmYsEDGz2Y,75
29
+ kisa_utils-0.38.0.dist-info/RECORD,,