0

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

ZF007
  • 3,708
  • 8
  • 29
  • 48

1 Answers1

0

It looks like you might be trying to access tg.request.POST from your controller action but as you use <a href="${tg.url('/results' ... to create those links they will be GET requests which can't have POST params.

If that's the case I suggest you just don't use tg.request.POST but use tg.request.args_params instead which should work for both POST and GET requests.

amol
  • 1,771
  • 1
  • 11
  • 15