On 3/20/11 09:04 , Mike Orr 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]

Yaiks - that change will effectively kill any site which does pagination over a large SQL table, so reverting it would be a good start. I don't see why the original line would raise that TypeError though. Did the bug submitter contribute a test to demonstrate that? It looks like he is strangely behaving collection type.

Wichert.

--
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