It looks like  t2.display() and t2.read() could use record=None too.
I will submit a patch later.

I noticed that t2.itemize() uses limitby for offsets, which will break
down when trying to scale it on appengine, because BigTable does
linear scans to performing offsets, so large page numbers would have
to scan all records of all previous pages (ouch).  Instead GAE needs a
next=key param that points to the first record of the next page, and
starts the scan from there.

Since you do not know the total count of records in BigTable, if you
have n items per page, you query for n+1 items and if n+1 items are
returned, then you indicate there is another page and set next= the
key of that extra record.

On GAE, it is possible to use sharded counters to estimate the number
of records in a table, which would let you project how many pages are
available.

Will it fit into t2's plan to accommodate these constraints for GAE?
What is the best way to support these constraints?

Robin

On Jan 8, 11:35 pm, Robin B <[email protected]> wrote:
> I noticed that t2.logout() could use onlogout=None..
>
>     def logout(self,next='index',onlogout=None):
>         """
>         To use, create a controller:
>
>              def logout(): t2.logout(next='index')
>         """
>         request,response,session,cache,T,db=self._globals()
>         session.t2.person_id=None
>         session.t2.person_name=None
>         session.t2.person_email=None
>         session.t2.my_groups_id=None
>         if onlogout:
>           onlogout()
>         if next:
>             session.flash=self.messages.logged_out
>             self.redirect(next)
>
> The whole next='action' does not allow for extra args or vars.  I wish
> next= just accepted a string that was the target url, so you can
> construct a real url with args and vars and pass it to next.  Since
> next= is so strict, I am using onlogout to redirect the next url.
>
> Robin
>
> On Jan 8, 7:05 pm, mdipierro <[email protected]> wrote:
>
> > yes. please email me the patch.
>
> > On Jan 8, 6:32 pm, Robin B <[email protected]> wrote:
>
> > > t2.update takes a query parameter which is nice, but if you already
> > > have a reference to record you want to edit, then there is no need to
> > > query for it again.
>
> > > What about adding a record=None option just like SQLFORM that is
> > > compared to None before the query is attempted?
>
> > > # in t2.py
> > >     def update
> > > (self,table,record=None,query=None,next=None,deletable=True,
> > >                vars={},onaccept=None,ondelete=None):
> > >        ...
> > >         if record is not None:
> > >           rows = [record]
> > >         elif query:
> > >            rows=table._db(query).select(table.ALL,limitby=(0,1))
> > >         else:
> > >            id=self.id or self._error()
> > >            rows=table._db(table.id==id).select(table.ALL,limitby=
> > > (0,1))
>
> > > Robin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to