Check if items is a sqlalchemy query would be an immediate fix.

This can seriously kill a web server so paginate should be considered
unusable with sqlalchemy until this is resolved.

On 20 Mar 2011 08:04, "Mike Orr" <sluggos...@gmail.com> wrote:

I got this bug report in WebHelpers 1.3b1:

On Sat, Mar 19, 2011 at 9:36 PM, Bitbucket <issues-nore...@bitbucket.org>
wrote:
> New issue 63: Regression: paginate loads whole table when given SqlAlchemy
object
>
https://bitbucket.org/bbangert/webhelpers/issue/63/regression-paginate-loads-whole-table-when
>
> nh2 on Sun, 20 Mar 2011 05:36:05 +0100:
>
> Description:
>  The changeset <<changeset b82b9f9942bb>> replaces
> {{{
> list(obj[slice])
> }}}
> by
> {{{
> list(obj)[slice]
> }}}
>
> which results in **all** rows being loaded on e.g.
Page(Session.query(MyModel),filter(...)).
>
> Therefore, webhelpers 1.3b1 completely kills performance.
>
> Responsible:
>  bbangert


This was done in order to solve this big report:

> #59, by dennysonique:

> While using TurboGears 2 which relies on Webhelpers (sprox forms) I
> found this bug:

> Line 434 has an error causing:

> Module webhelpers.paginate:434 in init view

> self.items = list(self.collection[self.first_item-1:self.last_item])

> TypeError: unhashable type

> The solution to fix this is to change:

> -- self.items = list(self.collection[self.first_item-1:self.last_item])

> ++ self.items = list(self.collection)[self.first_item-1:self.last_item]


In other words, different users have contradictory desires. Should I
revert #59 and change it to WONTFIX, or is there a way to reconcile
these two? Or is this a reason to overhaul how paginate handles lists
vs queries overall? If so, what would be a better algorithm?

--
Mike Orr <sluggos...@gmail.com>

--
You received this message because you are subscribed to the Google Groups
"pylons-devel" group.
To post to this group, send email to pylons-devel@googlegroups.com.
To unsubscribe from this group, send email to
pylons-devel+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/pylons-devel?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To post to this group, send email to pylons-devel@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-devel?hl=en.

Reply via email to