Easy pagination for Pyramid applications! It currently has built-in support for paginating:
Iterable types (lists, tuples)
SQLAlchemy Query objects
But can support pagination over any data type via extensions.
Project
TL;DR
Install with:
$ pip install pyramid_pagination
Use default pagination with:
from pyramid_pagination import paginate
@paginate
def view(request): return range(30)
Then a request without parameters results in:
{
"result": [0, 1, 2, ... , 22, 23, 24],
"page": {
"offset": 0,
"limit": 25,
"count": 30,
"attribute": "result"
}
}
Paginating with some defaults changed and adding some attribute-based sort methods:
from pyramid_pagination import paginate
@paginate(limit_default=2, comparers=['name', 'value'])
def view(request):
return [
dict(name='alph', value=1),
dict(name='beta', value=2),
dict(name='zeta', value=3),
dict(name='alph', value=4),
]
Then a request with parameters ?page.offset=1&page.limit=3&page.sort=name-,value results in:
{
"result": [
{"name": "beta", "value": 2},
{"name": "alph", "value": 1},
{"name": "alph", "value": 4}
],
"page": {
"offset": 1,
"limit": 3,
"count": 4,
"sort": "name-,value",
"attribute": "result"
}
}
Metadata
Release files for pyramid_pagination 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pyramid_pagination-0.1.6.tar.gz | 17.3 kB | Without provenance | Details |
Release files / pyramid_pagination-0.1.6.tar.gz
| Download URL | pyramid_pagination-0.1.6.tar.gz |
|---|---|
| Size | 17.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
769ca15c1310521d9da4bf9a38feba317eda0f594ae565656879fa537d693222
|
|
BLAKE2b-256 checksum How to use checksums |
68f21ebf9d557e4f000e02640d7455849c7ab86e55d1b510087f32a0dab61842
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pyramid_pagination 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.