autonomous-app 0.3.8__py3-none-any.whl → 0.3.10__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.
autonomous/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "0.3.8"
1
+ __version__ = "0.3.10"
2
2
 
3
3
  from dotenv import load_dotenv
4
4
 
@@ -259,12 +259,6 @@ class BaseField:
259
259
  # next(iter) is useful for sets
260
260
  choice_list = [k for k, _ in choice_list]
261
261
 
262
- # log(
263
- # value,
264
- # type(value),
265
- # choice_list,
266
- # value in choice_list,
267
- # )
268
262
  # Choices which are other types of Documents
269
263
  if isinstance(value, (Document, EmbeddedDocument)):
270
264
  if not any(isinstance(value, c) for c in choice_list):
@@ -273,6 +267,7 @@ class BaseField:
273
267
  else:
274
268
  values = value if isinstance(value, (list, tuple)) else [value]
275
269
  if len(set(values) - set(choice_list)):
270
+ raise Exception(f"Value must be one of {choice_list}, not {value}")
276
271
  self.error("Value must be one of %s" % str(choice_list))
277
272
 
278
273
  def _validate(self, value, **kwargs):
autonomous/db/document.py CHANGED
@@ -417,7 +417,6 @@ class Document(BaseDocument, metaclass=TopLevelDocumentMetaclass):
417
417
  if self._meta.get("abstract"):
418
418
  raise InvalidDocumentError("Cannot save an abstract document.")
419
419
  signals.pre_save.send(self.__class__, document=self, **signal_kwargs)
420
-
421
420
  if validate:
422
421
  self.validate(clean=clean)
423
422
 
autonomous/db/fields.py CHANGED
@@ -1483,21 +1483,22 @@ class GenericReferenceField(BaseField):
1483
1483
  )
1484
1484
 
1485
1485
  def _validate_choices(self, value):
1486
- # log(value, self.null)
1487
1486
  if not value and self.null:
1488
1487
  return
1489
1488
  elif isinstance(value, dict):
1490
1489
  # If the field has not been dereferenced, it is still a dict
1491
1490
  # of class and DBRef
1492
- value = value.get("_cls")
1493
- elif isinstance(value, Document):
1491
+ # value = value.get("_cls")
1492
+ try:
1493
+ value = self._lazy_load_ref(
1494
+ get_document(value.get("_cls")), value.get("_ref")
1495
+ )
1496
+ except DoesNotExist:
1497
+ log(f"{value} DoesNotExist")
1498
+ return
1499
+
1500
+ if isinstance(value, Document):
1494
1501
  mro = [cls.__name__ for cls in value.__class__.mro()]
1495
- # log(
1496
- # value,
1497
- # mro,
1498
- # self.choices,
1499
- # _print=True,
1500
- # )
1501
1502
  base_value = None
1502
1503
  for choice in self.choices:
1503
1504
  if choice in mro:
@@ -1510,19 +1511,8 @@ class GenericReferenceField(BaseField):
1510
1511
  f"Invalid Model Type. Must be or derive from on of: {self.choices}, not: {value} for attribute {self.name}"
1511
1512
  )
1512
1513
  else:
1513
- # log(
1514
- # value,
1515
- # type(value),
1516
- # "!!!! Need to update to this !!!!",
1517
- # _print=True,
1518
- # )
1519
1514
  value = value.__class__.__name__
1520
- # log(
1521
- # value,
1522
- # self.choices,
1523
- # type(value),
1524
- # _print=True,
1525
- # )
1515
+ # log(value, type(value))
1526
1516
  super()._validate_choices(value)
1527
1517
 
1528
1518
  @staticmethod
@@ -56,7 +56,7 @@ class ReferenceAttr(GenericReferenceField):
56
56
  try:
57
57
  result = super().__get__(instance, owner)
58
58
  except DoesNotExist as e:
59
- log(f"ReferenceAttr Error: {e}")
59
+ # log(f"ReferenceAttr Error: {e}")
60
60
  return None
61
61
  return result
62
62
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: autonomous-app
3
- Version: 0.3.8
3
+ Version: 0.3.10
4
4
  Summary: Containerized application framework built on Flask with additional libraries and tools for rapid development of web applications.
5
5
  Author-email: Steven A Moore <samoore@binghamton.edu>
6
6
  License: MIT License
@@ -1,4 +1,4 @@
1
- autonomous/__init__.py,sha256=q0cQm-Q3XSltw1aU23O8UpgDeWEggn7848DGiRy9azg,94
1
+ autonomous/__init__.py,sha256=Dn8prVUFGQKGuSuYkNWrQJsqwV_BmZ_P6N4aCquBaiQ,95
2
2
  autonomous/cli.py,sha256=z4AaGeWNW_uBLFAHng0J_lfS9v3fXemK1PeT85u4Eo4,42
3
3
  autonomous/logger.py,sha256=NQtgEaTWNAWfLSgqSP7ksXj1GpOuCgoUV711kSMm-WA,2022
4
4
  autonomous/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -24,9 +24,9 @@ autonomous/db/common.py,sha256=BUN2x_XuQBRFcq54TGPx4yLMLJdgytdbIt07QWr4CSM,2551
24
24
  autonomous/db/connection.py,sha256=j_-eMre4ade9Y8GejJcMbQQiSEimL4j2vIQxaXViKxI,17754
25
25
  autonomous/db/context_managers.py,sha256=_nH2ajCL8Xy90AuB2rKaryR4iF8Q8ksU3Nei_mZj-DE,9918
26
26
  autonomous/db/dereference.py,sha256=EgbpPCXtDZqD_ZuY1Wd4o3ltRy8qEo3C5yRh5_c9fLE,12776
27
- autonomous/db/document.py,sha256=PGbCbkx3Los4zOj0Da6YcLCv_rR-xXp_7X6qivjAsL4,44429
27
+ autonomous/db/document.py,sha256=oZKdTaoqwv9fCHiv450rIxgINASQF3J9FzIsUOUXHhw,44428
28
28
  autonomous/db/errors.py,sha256=_QeCotid1kmr7_W0QyH6NUrwwYN9eced_yyyiop0Xlw,4108
29
- autonomous/db/fields.py,sha256=bAF2LSJ4Ys-eY89rKp1C9jIJjqtQnuDHNyig1tidSrc,93765
29
+ autonomous/db/fields.py,sha256=YMeXO5C8hiWKrknmQtaWOKDF-b1pMVEvCnlZrjMBamE,93568
30
30
  autonomous/db/mongodb_support.py,sha256=u0X-zpqTIZZP8o2-IDyKRKHL8ALLhvW1VSGtK3fLyos,626
31
31
  autonomous/db/pymongo_support.py,sha256=UEZ4RHAGb_t1nuMUAJXMNs0vdH3dutxAH5mwFCmG6jI,2951
32
32
  autonomous/db/signals.py,sha256=BM-M4hh4SrTbV9bZVIEWTG8mxgKn9Lo2rC7owLJz4yQ,1791
@@ -34,7 +34,7 @@ autonomous/db/base/__init__.py,sha256=qbVw-SlbJxlWu8UoPLQcwyRQ7Oso0r3aUit6Jqpoz4
34
34
  autonomous/db/base/common.py,sha256=YjvDGwmn-QoRplL9Xx2q3eUXEetgo3YureIGxbR36Y8,1540
35
35
  autonomous/db/base/datastructures.py,sha256=fcgWe2JsfzTK3jbku3Teh0Iwvn5U5EhCpyeh9xr8bZ0,15850
36
36
  autonomous/db/base/document.py,sha256=OM7CeJFZbxha6yKMiMCrHOlTELfOXusqJ8i6FjdFd0c,46652
37
- autonomous/db/base/fields.py,sha256=6hz8w5rrP-piE4Ox_g99Z8rIluqyTgetLngvdhjIgL0,29055
37
+ autonomous/db/base/fields.py,sha256=NorRXWR_NAJ1D2XkuICfEB6tM977-AaboYl3R2uSy8E,29001
38
38
  autonomous/db/base/metaclasses.py,sha256=GVvJYcCxaW1ltEqyH4oNvT_srckEXDSHOtHVU_TAN70,18138
39
39
  autonomous/db/base/utils.py,sha256=MH4FuEwh-5IcIinwNTkyTs-PqQLyyiMctcYMsNP85qk,617
40
40
  autonomous/db/queryset/__init__.py,sha256=XT3__0BJCvQIQj3S_Mp7mPxNBkfdvXkdw56cg2gc86o,756
@@ -45,7 +45,7 @@ autonomous/db/queryset/queryset.py,sha256=Xvt1q7Olij9STbJkHm6dKrUIrgyJeY_uwJOYE9
45
45
  autonomous/db/queryset/transform.py,sha256=UhBdDxYR_bWH0ECnaSw9g9YMwgWRZtsRl_q6PkqO9eY,19615
46
46
  autonomous/db/queryset/visitor.py,sha256=AN09lR6hWYUlKJC7G1sktvnWy5hrFnpoQhi58bOXbA4,5470
47
47
  autonomous/model/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
48
- autonomous/model/autoattr.py,sha256=ncDSV5gFWqgLKzstYxndQWlM911_gxwzPuf74M-UfFk,2252
48
+ autonomous/model/autoattr.py,sha256=eqO3QE17EMRzLvtF74gXefeK1I2N-w6uScpibdChVOw,2254
49
49
  autonomous/model/automodel.py,sha256=Q5S84TsIXZT4r0AFQS6OQm4oRIMPWWfuUhD0i5gsm7s,6809
50
50
  autonomous/storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
51
  autonomous/storage/imagestorage.py,sha256=SmBjBNBlP1ZEjxdOnGVzCHZhbEhMKTUQC2TbpWbejDE,6168
@@ -53,8 +53,8 @@ autonomous/storage/localstorage.py,sha256=FzrR6O9mMGAZt5dDgqzkeOQVfGRXCygR0kksz2
53
53
  autonomous/tasks/__init__.py,sha256=pn7iZ14MhcHUdzcLkfkd4-45wgPP0tXahAz_cFgb_Tg,32
54
54
  autonomous/tasks/autotask.py,sha256=aK5iapDhgcAic3F5ZYMAhNKJkOepj8yWwbMizKDzUwQ,4153
55
55
  autonomous/utils/markdown.py,sha256=tf8vlHARiQO1X_aGbqlYozzP_TbdiDRT9EEP6aFRQo0,2153
56
- autonomous_app-0.3.8.dist-info/LICENSE,sha256=-PHHSuDRkodHo3PEdMkDtoIdmLAOomMq6lsLaOetU8g,1076
57
- autonomous_app-0.3.8.dist-info/METADATA,sha256=Rhdiy8oShbPFAXcCYa29G5qYmSuAfhtDese8rBYJ1x0,4188
58
- autonomous_app-0.3.8.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
59
- autonomous_app-0.3.8.dist-info/top_level.txt,sha256=ZyxWWDdbvZekF3UFunxl4BQsVDb_FOW3eTn0vun_jb4,11
60
- autonomous_app-0.3.8.dist-info/RECORD,,
56
+ autonomous_app-0.3.10.dist-info/LICENSE,sha256=-PHHSuDRkodHo3PEdMkDtoIdmLAOomMq6lsLaOetU8g,1076
57
+ autonomous_app-0.3.10.dist-info/METADATA,sha256=upj_wHgFA1y662oLqs3zquNMJSymw6Do_XgLXAK6WVM,4189
58
+ autonomous_app-0.3.10.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
59
+ autonomous_app-0.3.10.dist-info/top_level.txt,sha256=ZyxWWDdbvZekF3UFunxl4BQsVDb_FOW3eTn0vun_jb4,11
60
+ autonomous_app-0.3.10.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (75.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5