I have created pithy/html/parts.py, which has an unimplemented function pagination_control. The implementation should be factored out from pithy.selectrender_pagination_control. The tricky part is that I do not want to use the QueryParams type. Instead we should treat the params argument as a generic Mapping. You should iterate over the items in the mapping, swapping in the new offset.
Something like:
from url lib.parse import urlencode
page_params = dict(params)
page_params['offset'] = offset
href = f'?{urlencode(tuple((k, str(v)) for k, v in params.items()))}'
That last line was copied from pithy.url.fmt_url, which might serve as a reference to play with if something doesn't seem right.
I have created
pithy/html/parts.py
, which has an unimplemented functionpagination_control
. The implementation should be factored out frompithy.select
render_pagination_control
. The tricky part is that I do not want to use theQueryParams
type. Instead we should treat the params argument as a genericMapping
. You should iterate over the items in the mapping, swapping in the new offset.Something like:
That last line was copied from pithy.url.fmt_url, which might serve as a reference to play with if something doesn't seem right.