muffin-rest 9.0.0__py3-none-any.whl → 9.2.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.
@@ -92,18 +92,18 @@ class PWRESTBase(RESTBase[TVModel], PeeweeOpenAPIMixin):
92
92
 
93
93
  async def paginate(self, _: Request, *, limit: int = 0, offset: int = 0):
94
94
  """Paginate the collection."""
95
- cqs = cast(pw.ModelSelect, self.collection.order_by())
96
- if cqs._group_by: # type: ignore[misc]
97
- cqs._returning = cqs._group_by # type: ignore[misc]
98
- cqs._having = None # type: ignore[misc]
99
- count = None
100
95
  if self.meta.limit_total:
101
- count = await self.meta.manager.count(self.collection)
96
+ cqs = cast(pw.ModelSelect, self.collection.order_by())
97
+ if cqs._group_by: # type: ignore[misc]
98
+ cqs._returning = cqs._group_by # type: ignore[misc]
99
+ cqs._having = None # type: ignore[misc]
102
100
 
103
- return (
104
- cast(pw.ModelSelect, self.collection.offset(offset).limit(limit)), # type: ignore[misc]
105
- count,
106
- )
101
+ count = await self.meta.manager.count(cqs)
102
+
103
+ else:
104
+ count = None
105
+
106
+ return self.collection.offset(offset).limit(limit), count
107
107
 
108
108
  async def get(self, request, *, resource: Optional[TVModel] = None) -> Any:
109
109
  """Get resource or collection of resources."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: muffin-rest
3
- Version: 9.0.0
3
+ Version: 9.2.0
4
4
  Summary: The package provides enhanced support for writing REST APIs with Muffin framework
5
5
  Home-page: https://github.com/klen/muffin-rest
6
6
  License: MIT
@@ -26,11 +26,11 @@ Provides-Extra: sqlalchemy
26
26
  Provides-Extra: yaml
27
27
  Requires-Dist: apispec (>=6,<7)
28
28
  Requires-Dist: marshmallow (>=3,<4)
29
- Requires-Dist: marshmallow-peewee (>=4,<5) ; extra == "peewee"
29
+ Requires-Dist: marshmallow-peewee ; extra == "peewee"
30
30
  Requires-Dist: marshmallow-sqlalchemy ; extra == "sqlalchemy"
31
31
  Requires-Dist: muffin (>=0,<1)
32
- Requires-Dist: muffin-databases (>=0.5.0,<0.6.0) ; extra == "sqlalchemy"
33
- Requires-Dist: muffin-peewee-aio (>=0,<1) ; extra == "peewee"
32
+ Requires-Dist: muffin-databases ; extra == "sqlalchemy"
33
+ Requires-Dist: muffin-peewee-aio ; extra == "peewee"
34
34
  Requires-Dist: pyyaml ; extra == "yaml"
35
35
  Requires-Dist: sqlalchemy ; extra == "sqlalchemy"
36
36
  Project-URL: Repository, https://github.com/klen/muffin-rest
@@ -15,7 +15,7 @@ muffin_rest/openapi.py,sha256=0QU7qrfBjGl0vl378SJC5boZZI2ogddl45fS9WL4Axw,8751
15
15
  muffin_rest/options.py,sha256=reHbd2o-F6bKEKc8bznzj0TMY2vzjK6Yt1qOny7kt_w,2691
16
16
  muffin_rest/peewee/__init__.py,sha256=94DSj_ftT6fbPksHlBv40AH2HWaiZommUFOMN2jd9a4,129
17
17
  muffin_rest/peewee/filters.py,sha256=oghjKwurNCyFUYT0r2TVu2Nd1SIalRsmbU4_RbaoXLs,2440
18
- muffin_rest/peewee/handler.py,sha256=tfmRzCWCV41x_k9Ysma735MPsNOx-o4Bnp5hFIbSxu0,5354
18
+ muffin_rest/peewee/handler.py,sha256=Tk20ChTGkhzSF0K1-TFruPfXJyHfJE_fDKcQqGQeoAU,5297
19
19
  muffin_rest/peewee/openapi.py,sha256=lDnLnoXi33p0YeFVwRgaVrndyrG2XL93RH-BzbxinOY,1105
20
20
  muffin_rest/peewee/options.py,sha256=TimJtErC9e8B7BRiEkHiBZd71_bZbYr-FE2PIlQvfH0,1455
21
21
  muffin_rest/peewee/schemas.py,sha256=w6jBziUp40mOOjkz_4RCXuY0x5ZDIe9Ob25k1FnZSfc,469
@@ -33,7 +33,7 @@ muffin_rest/sqlalchemy/types.py,sha256=Exm-zAQCtPAwXvYcCTtPRqSa-wTEWRcH_v2YSsJkB
33
33
  muffin_rest/swagger.html,sha256=2uGLu_KpkYf925KnDKHBJmV9pm6OHn5C3BWScESsUS8,1736
34
34
  muffin_rest/types.py,sha256=lU0tAaDu9sKm-30RM1_qOx-hOYEkNRaA72LdWDvg72g,491
35
35
  muffin_rest/utils.py,sha256=c08E4HJ4SLYC-91GKPEbsyKTZ4sZbTN4qDqJbNg_HTE,2076
36
- muffin_rest-9.0.0.dist-info/LICENSE,sha256=xHPkOZhjyKBMOwXpWn9IB_BVLjrrMxv2M9slKkHj2hM,1082
37
- muffin_rest-9.0.0.dist-info/METADATA,sha256=3chS--H-C60xpvb9nBi6hlBfRCjEUOQ8Jd8gJGq11uM,4169
38
- muffin_rest-9.0.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
39
- muffin_rest-9.0.0.dist-info/RECORD,,
36
+ muffin_rest-9.2.0.dist-info/LICENSE,sha256=xHPkOZhjyKBMOwXpWn9IB_BVLjrrMxv2M9slKkHj2hM,1082
37
+ muffin_rest-9.2.0.dist-info/METADATA,sha256=ZB8W02vkcIb8ZrwPQEGeF5MH7P9A2g9ZMfJ-943x1WE,4134
38
+ muffin_rest-9.2.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
39
+ muffin_rest-9.2.0.dist-info/RECORD,,