autonomous-app 0.3.2__py3-none-any.whl → 0.3.3__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 +1 -1
- autonomous/db/fields.py +1 -1
- autonomous/model/automodel.py +9 -5
- {autonomous_app-0.3.2.dist-info → autonomous_app-0.3.3.dist-info}/METADATA +1 -1
- {autonomous_app-0.3.2.dist-info → autonomous_app-0.3.3.dist-info}/RECORD +8 -8
- {autonomous_app-0.3.2.dist-info → autonomous_app-0.3.3.dist-info}/LICENSE +0 -0
- {autonomous_app-0.3.2.dist-info → autonomous_app-0.3.3.dist-info}/WHEEL +0 -0
- {autonomous_app-0.3.2.dist-info → autonomous_app-0.3.3.dist-info}/top_level.txt +0 -0
autonomous/__init__.py
CHANGED
autonomous/db/fields.py
CHANGED
|
@@ -1541,7 +1541,7 @@ class GenericReferenceField(BaseField):
|
|
|
1541
1541
|
value = instance._data.get(self.name)
|
|
1542
1542
|
|
|
1543
1543
|
auto_dereference = instance._fields[self.name]._auto_dereference
|
|
1544
|
-
if auto_dereference and isinstance(value, dict):
|
|
1544
|
+
if auto_dereference and isinstance(value, dict) and "_cls" in value:
|
|
1545
1545
|
doc_cls = get_document(value["_cls"])
|
|
1546
1546
|
instance._data[self.name] = self._lazy_load_ref(doc_cls, value["_ref"])
|
|
1547
1547
|
|
autonomous/model/automodel.py
CHANGED
|
@@ -3,13 +3,12 @@ import os
|
|
|
3
3
|
import urllib.parse
|
|
4
4
|
from datetime import datetime
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import bson
|
|
7
7
|
|
|
8
8
|
from autonomous import log
|
|
9
9
|
from autonomous.db import Document, connect, signals
|
|
10
10
|
from autonomous.db.errors import ValidationError
|
|
11
11
|
from autonomous.db.fields import DateTimeField
|
|
12
|
-
from autonomous.model.autoattr import DictAttr, ListAttr
|
|
13
12
|
|
|
14
13
|
host = os.getenv("DB_HOST", "db")
|
|
15
14
|
port = os.getenv("DB_PORT", 27017)
|
|
@@ -33,7 +32,9 @@ class AutoModel(Document):
|
|
|
33
32
|
values = kwargs.pop("values", None)
|
|
34
33
|
if pk := values.get("pk") or values.get("id"):
|
|
35
34
|
# Try to load the existing document from the database
|
|
36
|
-
if existing_doc := sender._get_collection().find_one(
|
|
35
|
+
if existing_doc := sender._get_collection().find_one(
|
|
36
|
+
{"_id": bson.ObjectId(pk)}
|
|
37
|
+
):
|
|
37
38
|
# Update the current instance with the existing data
|
|
38
39
|
existing_doc.pop("_id", None)
|
|
39
40
|
existing_doc.pop("_cls", None)
|
|
@@ -84,9 +85,12 @@ class AutoModel(Document):
|
|
|
84
85
|
"""
|
|
85
86
|
|
|
86
87
|
if isinstance(pk, str):
|
|
87
|
-
|
|
88
|
+
try:
|
|
89
|
+
pk = bson.ObjectId(pk)
|
|
90
|
+
except bson.errors.InvalidId:
|
|
91
|
+
return None
|
|
88
92
|
elif isinstance(pk, dict) and "$oid" in pk:
|
|
89
|
-
pk = ObjectId(pk["$oid"])
|
|
93
|
+
pk = bson.ObjectId(pk["$oid"])
|
|
90
94
|
try:
|
|
91
95
|
return cls.objects.get(id=pk)
|
|
92
96
|
except cls.DoesNotExist as e:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: autonomous-app
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
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=
|
|
1
|
+
autonomous/__init__.py,sha256=wCfQNGBJhN4rEvMfAPaMaJATBVzi6ntQbyINkZejQmA,94
|
|
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
|
|
@@ -26,7 +26,7 @@ autonomous/db/context_managers.py,sha256=_nH2ajCL8Xy90AuB2rKaryR4iF8Q8ksU3Nei_mZ
|
|
|
26
26
|
autonomous/db/dereference.py,sha256=Q_LkFwG5Be8XFKuwgvOIMb87R1DpavFbCOV2HdJV56Q,12573
|
|
27
27
|
autonomous/db/document.py,sha256=PGbCbkx3Los4zOj0Da6YcLCv_rR-xXp_7X6qivjAsL4,44429
|
|
28
28
|
autonomous/db/errors.py,sha256=_QeCotid1kmr7_W0QyH6NUrwwYN9eced_yyyiop0Xlw,4108
|
|
29
|
-
autonomous/db/fields.py,sha256=
|
|
29
|
+
autonomous/db/fields.py,sha256=kK1uGXyjjQwEDf1YFIfebCpA7wFnl-epudfXHI57lKo,93747
|
|
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
|
|
@@ -46,15 +46,15 @@ autonomous/db/queryset/transform.py,sha256=UhBdDxYR_bWH0ECnaSw9g9YMwgWRZtsRl_q6P
|
|
|
46
46
|
autonomous/db/queryset/visitor.py,sha256=AN09lR6hWYUlKJC7G1sktvnWy5hrFnpoQhi58bOXbA4,5470
|
|
47
47
|
autonomous/model/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
48
48
|
autonomous/model/autoattr.py,sha256=7yLhkohTxGseOYhOJ_oDT1QD56UWhHEVdXP5yEsBJZE,2822
|
|
49
|
-
autonomous/model/automodel.py,sha256=
|
|
49
|
+
autonomous/model/automodel.py,sha256=cEII68skKHSCbxx9-BTY9wLBkqvJeMceXku5F9bxhwc,6792
|
|
50
50
|
autonomous/storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
51
51
|
autonomous/storage/imagestorage.py,sha256=SmBjBNBlP1ZEjxdOnGVzCHZhbEhMKTUQC2TbpWbejDE,6168
|
|
52
52
|
autonomous/storage/localstorage.py,sha256=FzrR6O9mMGAZt5dDgqzkeOQVfGRXCygR0kksz2MPpwE,2286
|
|
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.
|
|
57
|
-
autonomous_app-0.3.
|
|
58
|
-
autonomous_app-0.3.
|
|
59
|
-
autonomous_app-0.3.
|
|
60
|
-
autonomous_app-0.3.
|
|
56
|
+
autonomous_app-0.3.3.dist-info/LICENSE,sha256=-PHHSuDRkodHo3PEdMkDtoIdmLAOomMq6lsLaOetU8g,1076
|
|
57
|
+
autonomous_app-0.3.3.dist-info/METADATA,sha256=IX1zBDszQLS3hAHqZVyZaX7Y1MShWWL786_3JGBv8Zw,4188
|
|
58
|
+
autonomous_app-0.3.3.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
|
|
59
|
+
autonomous_app-0.3.3.dist-info/top_level.txt,sha256=ZyxWWDdbvZekF3UFunxl4BQsVDb_FOW3eTn0vun_jb4,11
|
|
60
|
+
autonomous_app-0.3.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|