This might be completely wrong but did you try using the slice operator?
like so:

if len(rows) == max+1:
   #lose last row!
   #but how?
results = self.build_results( *rows[:max] *)
return results

Sorry if it doesn't work. I can't try it now.

Regards,
Tiago Almeida

On Thu, Apr 15, 2010 at 10:48 AM, Carl <carl.ro...@gmail.com> wrote:

> I'm building a ui that lists results to the user. if there are further
> results available a "More" button allows the user to retrieve them
> (and have them displayed beneath the existing results)
>
> To calculate if there are indeed more results available I am using
> limitby and requesting one more result than I return to the client for
> display.
>
> outline code...
>
> max=10
> query=...
> rows = self.db(query).select(..., limitby=(0,max+1))
>
> if len(rows) == max+1:
>    #lose last row!
>    #but how?
> results = self.build_results(rows)
> return results
>
> I want to lose the last row of rows before passing it to build_results
> AND leave the database records untouched.
>
> I'm guessing the solution is straightforward and I'm just slow this
> morning! :)
>
>
> --
> To unsubscribe, reply using "remove me" as the subject.
>

Reply via email to