I'm not sure either. You've got a lot of use cases covered already.
Here's what i do:
collection = Companies.list(limit, start)
c.companies = h.Page(collection['items'], page, limit,
collection['total'])
return render('/portal/companies/companies.mako')
Then I've got template:
% for company in c.companies.collection:
% endfor
${c.companies.pager('Page: ~1~', 'id')}
Since there's appears to be no way to just draw the paginator without
initing Page, that`s the way to do it for now.
Probably it'll make sense to add this
On Jul 9, 4:09 pm, Christoph Haas <[EMAIL PROTECTED]> wrote:
> Hi, Pavel...
>
> On Mittwoch, 9. Juli 2008, Pavel Skvazh wrote:
>
> > I'd like to share a use case with paginate.
> > I've got a model that serves query results in the format I need. It
> > manages starts and limits, includes [totalrow] property so I just need
> > paginate to draw a nice paging bar.
>
> > Everything works fine, but one line messes it up for me.
>
> > self.items = list(self.collection[self.first_item-1:self.last_item])
>
> > Here it takes only the range from the passed array. My situation
> > implies that I've already got full array fetched from the database, so
> > I need it just to be left intact.
>
> > so I changed it to self.items = list(self.collection) and it works
> > like a charm.
>
> Why do you do that? If you just use the .pager() method to draw the paging
> bar then you shouldn't need the self.items there (unless you use it
> somewhere else). However I think this case is kind of special and I'm
> hesitating to add that to the code right away.
>
> Cheers
> Christoph
>
> signature.asc
> 1KDownload
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---