I've been trying to paginate a search results page. Which uses POST requests to submit my search form.
I just included the parameters in the pager function and it uses GET method as default.
"<a href="${tg.url('/results',dict(request.args_params, page=tmpl_context.paginators.results.first_page))}">«</a>"
${tmpl_context.paginators.leads.pager()}
"<a href="${tg.url('/results',dict(request.args_params,page=tmpl_context.paginators.results.last_page))}">»</a>"
With this code, while I'm trying to navigate to another page on the pager, showing the error:
KeyError("No key 'filter': Not an HTML form submission (Content-Type: text/plain)",)
Python: 2.7
TurboGears: 2.3.12
It looks like you might be trying to access
tg.request.POSTfrom your controller action but as you use<a href="${tg.url('/results' ...to create those links they will beGETrequests which can't havePOSTparams.If that's the case I suggest you just don't use
tg.request.POSTbut usetg.request.args_paramsinstead which should work for bothPOSTandGETrequests.