panther 4.2.4__py3-none-any.whl → 4.2.6__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.
- panther/__init__.py +1 -1
- panther/db/queries/mongodb_queries.py +2 -0
- panther/db/queries/pantherdb_queries.py +2 -0
- panther/db/queries/queries.py +7 -1
- {panther-4.2.4.dist-info → panther-4.2.6.dist-info}/METADATA +1 -1
- {panther-4.2.4.dist-info → panther-4.2.6.dist-info}/RECORD +10 -10
- {panther-4.2.4.dist-info → panther-4.2.6.dist-info}/WHEEL +1 -1
- {panther-4.2.4.dist-info → panther-4.2.6.dist-info}/LICENSE +0 -0
- {panther-4.2.4.dist-info → panther-4.2.6.dist-info}/entry_points.txt +0 -0
- {panther-4.2.4.dist-info → panther-4.2.6.dist-info}/top_level.txt +0 -0
panther/__init__.py
CHANGED
@@ -114,6 +114,8 @@ class BaseMongoDBQuery(BaseQuery):
|
|
114
114
|
else:
|
115
115
|
update_query['$set'] = update_query.get('$set', {})
|
116
116
|
update_query['$set'][field] = value
|
117
|
+
if isinstance(value, dict):
|
118
|
+
value = type(getattr(self, field))(**value)
|
117
119
|
setattr(self, field, value)
|
118
120
|
|
119
121
|
await db.session[self.__class__.__name__].update_one({'_id': self._id}, update_query)
|
@@ -96,6 +96,8 @@ class BasePantherDBQuery(BaseQuery):
|
|
96
96
|
self._validate_data(data=kwargs, is_updating=True)
|
97
97
|
|
98
98
|
for field, value in document.items():
|
99
|
+
if isinstance(value, dict):
|
100
|
+
value = type(getattr(self, field))(**value)
|
99
101
|
setattr(self, field, value)
|
100
102
|
db.session.collection(self.__class__.__name__).update_one({'_id': self._id}, **document)
|
101
103
|
|
panther/db/queries/queries.py
CHANGED
@@ -2,6 +2,7 @@ import sys
|
|
2
2
|
from typing import Sequence, Iterable
|
3
3
|
|
4
4
|
from pantherdb import Cursor as PantherDBCursor
|
5
|
+
from pydantic import BaseModel
|
5
6
|
|
6
7
|
from panther.configs import QueryObservable
|
7
8
|
from panther.db.cursor import Cursor
|
@@ -402,7 +403,12 @@ class Query(BaseQuery):
|
|
402
403
|
>>> user = User(name='Ali')
|
403
404
|
>>> await user.save()
|
404
405
|
"""
|
405
|
-
document = {
|
406
|
+
document = {
|
407
|
+
field: getattr(self, field).model_dump()
|
408
|
+
if issubclass(type(getattr(self, field)), BaseModel)
|
409
|
+
else getattr(self, field)
|
410
|
+
for field in self.model_fields.keys() if field != 'request'
|
411
|
+
}
|
406
412
|
|
407
413
|
if self.id:
|
408
414
|
await self.update(document)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
panther/__init__.py,sha256=
|
1
|
+
panther/__init__.py,sha256=tmDiShQr_-JjYBeI3TswawX-WkQFwh8Hmd0pmBS_6-8,110
|
2
2
|
panther/_load_configs.py,sha256=AVkoixkUFkBQiTmrLrwCmg0eiPW2U_Uw2EGNEGQRfnI,9281
|
3
3
|
panther/_utils.py,sha256=j0rwIxTf0rtcZAAD-1nGE-_bWpvinyKtnwt3uO0hMmY,4330
|
4
4
|
panther/app.py,sha256=e2eb4sXIaBje5vpcm4pbvvEO_sj83pLfBHCIZJFFX38,8222
|
@@ -40,18 +40,18 @@ panther/db/models.py,sha256=GRbKXJiwnxQJ_SjuPfXPzA5miH_djZNTPPyqiRp5DI8,2561
|
|
40
40
|
panther/db/utils.py,sha256=ZZa3TMkuRtssl5ZRItFLonyxvMFsTq4fmTD4BblhLDA,1589
|
41
41
|
panther/db/queries/__init__.py,sha256=uF4gvBjLBJ-Yl3WLqoZEVNtHCVhFRKW3_Vi44pJxDNI,45
|
42
42
|
panther/db/queries/base_queries.py,sha256=8HhdlsSW-lgz3-IrZYfOtHNC3TBWbCNErDR4XE718AY,3764
|
43
|
-
panther/db/queries/mongodb_queries.py,sha256=
|
44
|
-
panther/db/queries/pantherdb_queries.py,sha256=
|
45
|
-
panther/db/queries/queries.py,sha256=
|
43
|
+
panther/db/queries/mongodb_queries.py,sha256=VLRrUc6kO6YinzEa3mnxzOPv2YyAEh7KjPS4WwzCcRM,5707
|
44
|
+
panther/db/queries/pantherdb_queries.py,sha256=c9K3EHvOTZFN-1ZH8LUiK1BSXpEjPR8vaqPt5FuC05U,4581
|
45
|
+
panther/db/queries/queries.py,sha256=9VY8CMmn0wIbuQVHJO7U5xeym-53saYmFkRIL3sensc,12420
|
46
46
|
panther/middlewares/__init__.py,sha256=ydo0bSadGqa2v7Xy1oCTkF2uXrImedXjiyx2vPTwPhE,66
|
47
47
|
panther/middlewares/base.py,sha256=tX0MBvDBkbsAB_DilRIYvcggSAqCzazRTb9MegZNdlA,843
|
48
48
|
panther/panel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
49
49
|
panther/panel/apis.py,sha256=COsbwKZyTgyHvHYbpDfusifAH9ojMS3z1KhZCt9M-Ms,2428
|
50
50
|
panther/panel/urls.py,sha256=JiV-H4dWE-m_bfaTTVxzOxTvJmOWhyLOvcbM7xU3Bn4,240
|
51
51
|
panther/panel/utils.py,sha256=0Rv79oR5IEqalqwpRKQHMn1p5duVY5mxMqDKiA5mWx4,437
|
52
|
-
panther-4.2.
|
53
|
-
panther-4.2.
|
54
|
-
panther-4.2.
|
55
|
-
panther-4.2.
|
56
|
-
panther-4.2.
|
57
|
-
panther-4.2.
|
52
|
+
panther-4.2.6.dist-info/LICENSE,sha256=2aF1hL2aC0zRPjzUkSxJUzZbn2_uLoOkn7DHjzZni-I,1524
|
53
|
+
panther-4.2.6.dist-info/METADATA,sha256=UuyDwsfYekAvKNc_9GgkLiPnKs4zgraJUXY2jxRFxq4,6532
|
54
|
+
panther-4.2.6.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
55
|
+
panther-4.2.6.dist-info/entry_points.txt,sha256=6GPxYFGuzVfNB4YpHFJvYex6iWah5_tLnirAHwj2Qsg,51
|
56
|
+
panther-4.2.6.dist-info/top_level.txt,sha256=VbBs02JGXTIoHMzsX-eLOk2MCbBZzQbLhWiYpI7xI2g,8
|
57
|
+
panther-4.2.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|