le 02.11.2007 10:44 Diez B. Roggisch a écrit:
> On Thursday 01 November 2007 10:28:19 remi jolin wrote:
>   
>> le 01.11.2007 02:26 Roger Demetrescu a écrit:
>>     
>>> Short story:
>>>
>>> We want to hear your voice to help us decide how @paginate should
>>> handle "out of bound" pages.
>>>
>>> ======
>>>       
>> ...
>>
>>     
>>> Long story:
>>>
>>>
>>> Now, if we tamper our tg_paginate_no once again, but with 0 (zero) or
>>> negative numbers, we get:
>>>
>>> page -3 => result = []
>>> page -2 => result = [1, 2]
>>> page -1 => result = [3, 4, 5]
>>> page 0 => result = []
>>>       
>> shouldn't it gives
>> page -1 => [7, 8] (the last page)
>> page -2 => [4, 5, 6]
>> etc. ?
>>     
>
> No. Roger is right to propose a sanitizing of user-input, especially for the 
> cases where the results may change dynamically _while_ paging.
>
> Using the negative page offset semantics above is neither intuitive (the 
> pages 
> are numbered, it's not that pagination shows a _range_, so what we are 
> talking about is
>
> pages[-2]
>
> which is _one_ page, not the last 3 ones. Why should negative pagination 
> values suddenly change the total number of results shown?
>
>   
pages[-2] should produce the penultinate page, nothing less, nothing 
more (and pages[-1] the last page).
I don't understand why pages[-1] should produce a page with items 3, 4, 
5 as stated by Roger.
> And don't forget that the negative numbering is a (very) convenient feature 
> of 
> python's list-indices, but _not_ something people in general have any 
> expectations about.
>
>
> Diez
>
> >
>   

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to turbogears@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to