On Thursday, September 23, 2010 10:54:31 Juan Antonio Ibáñez wrote:
> I have one doubt about paginate webhelper. I can see following sample:
>
> ----------------------------------------------
> from webhelpers import paginate
>
> @expose("toscasample.templates.movie_list")
> def list(self, page=1):
> """List and paginate all movies in the database"""
> movies = DBSession.query(Movie)
> currentPage = paginate.Page(movies, page, items_per_page=5)
> return dict(movies=currentPage.items, page='ToscaSample Movie
> list', currentPage=currentPage)
> ----------------------------------------------
>
> Does it load all movie items before paginate? If yes, is possible to
> get only actual page items?
Page tries to optimize and only query what items there are needed for a given
page. If this is successful depends on what you pass to it. Queries should be
enhanced with offset and limit clauses. But then, it depends on your DB if that
really changes anything. E.g. ORACLE can't work with either AFAIK.
Diez
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en.