I have a controller method to show some data in a grid (not using
widgets), like this:
@expose(...)
def show_list(self, param1, param2)
.
.
.
And I do the URL mapping like this:
@expose(...)
def default(param0, param1, param2)
.
.
.
if param0 == 'xyz'
return show_list(param1, param2)
.
.
.
Now, to implement paginate, I had to change the default method like
this:
@expose(...)
def default(param0, param1, param2, **paginate_parameters)
.
.
.
if param0 == 'xyz'
paginate_parameters.update({'param1' : param1, 'param2' :
param2})
raise redirect(turbogears.url('/xyz', paginate_parameters))
.
.
.
Also, in the template, href_next and href_prev did not reflect param1
and param2, and I had to construct those manually like this:
<a py:if="tg.paginate.current_page != 1"
href="${tg.url('/' + param1 + '/' + param2,
tg_paginate_limit=tg.paginate.limit,
tg_paginate_no=tg.paginate.current_page-1)}">previous
</a>
Being an amateur, I doubt whether I am making things complex - there
might be simpler ways. Seeking suggestions.
thanks
sanjay
1. foo has some parameters
2. foo is called from default
thanks
sanjay