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 CHANGED
@@ -1,6 +1,6 @@
1
1
  from panther.main import Panther # noqa: F401
2
2
 
3
- __version__ = '4.2.4'
3
+ __version__ = '4.2.6'
4
4
 
5
5
 
6
6
  def version():
@@ -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
 
@@ -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 = {field: getattr(self, field) for field in self.model_fields_set if field != 'request'}
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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: panther
3
- Version: 4.2.4
3
+ Version: 4.2.6
4
4
  Summary: Fast & Friendly, Web Framework For Building Async APIs
5
5
  Home-page: https://github.com/alirn76/panther
6
6
  Author: Ali RajabNezhad
@@ -1,4 +1,4 @@
1
- panther/__init__.py,sha256=jXiDH-UBeYxx2lgu4JXs2xheg9VZnc4TKPmqsisk1KQ,110
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=4CQRdmgmKFIpnv6xijS0BMJO-Sf5beyuzmw8Z9jLtnA,5599
44
- panther/db/queries/pantherdb_queries.py,sha256=_dA4gXk1IA5jzIy6_6o1zgdZeeka6SPihvQeSkj7h68,4481
45
- panther/db/queries/queries.py,sha256=dWTiOjdIbrD_TajiyIlCKuFNyn-dkVEWvUFsmH2grjg,12236
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.4.dist-info/LICENSE,sha256=2aF1hL2aC0zRPjzUkSxJUzZbn2_uLoOkn7DHjzZni-I,1524
53
- panther-4.2.4.dist-info/METADATA,sha256=Nv8m1lQFmOM4DYsFWSARsnbR0EE5MwatWuGHP1JvDw4,6532
54
- panther-4.2.4.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
55
- panther-4.2.4.dist-info/entry_points.txt,sha256=6GPxYFGuzVfNB4YpHFJvYex6iWah5_tLnirAHwj2Qsg,51
56
- panther-4.2.4.dist-info/top_level.txt,sha256=VbBs02JGXTIoHMzsX-eLOk2MCbBZzQbLhWiYpI7xI2g,8
57
- panther-4.2.4.dist-info/RECORD,,
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,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (71.1.0)
2
+ Generator: setuptools (72.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5