thanks Tiago! Works flawlessly. I hadn't thought to drop the extra row on passing rows into build_results. (knew it was straightforward:)
On Apr 15, 11:19 am, Tiago Almeida <tiago.b.alme...@gmail.com> wrote: > 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.