person.name, person.age syntax is really nice, could be a good
addition to DAL.

I will try lambda syntax to define calculated fields, if this work as
I expect that's what I NEEEEEEEEEEEEEEEEEEEED

On Jul 8, 8:25 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Do not worry, we are not changing to an ORM. Right now you can do
> this:
>
> db.define_table('person',Field('birthdate','date'))
> db.person.age = lambda row: (request.now-request.birthdate).years
>
> for person in db().select(db.person.ALL):
>     print person.name,'is',db.person.age(person),'years old'
>
> perhaps we can introduce the syntax (pros/cons?)
>
> for person in db().select(db.person.ALL):
>     print person.name,'is',person.age,'years old'
>
> The current DAL does not support this latter syntax but something
> similar could be implemented in the new DAL without slowing down
> anything. Actually I expect the new DAL to be faster because there are
> no table lookups.
>
> Massmo
>
> On Jul 8, 11:09 am, SergeyPo <ser...@zarealye.com> wrote:
>
>
>
> > Please don't! DAL is minimalist now but that's what positively differs
> > web2py from others. In return it works fast (I'd say 10x faster than
> > RoR) and takes no time to learn.
>
> > On Jul 8, 6:35 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > I think this is gone off topic. The issue is whether it should be
> > > possible for a table to have dynamic columns that are calculated from
> > > the values of other columns and are not stored in the db. Right now
> > > the answer is not. You would have to implement such function outside
> > > of the DAL. Should the DAL provide such additional abstraction layer?
>
> > > Massimo
>
> > > On Jul 8, 3:33 am, Hans Donner <hans.don...@pobox.com> wrote:
>
> > > > On Wed, Jul 8, 2009 at 8:56 AM, Yarko Tymciurak<yark...@gmail.com> 
> > > > wrote:
>
> > > > > On Wed, Jul 8, 2009 at 1:55 AM, Yarko Tymciurak <yark...@gmail.com> 
> > > > > wrote:
>
> > > > >> On Wed, Jul 8, 2009 at 1:45 AM, Hans Donner <hans.don...@pobox.com> 
> > > > >> wrote:
>
> > > > >>> Hi All,
>
> > > > >>> yarko, are you carrying an ID? So if I want to know who you are you
> > > > >>> show me your ID aren't you?
>
> > > > >> I present those to log in;  I don't use those to say "I decide I am
> > > > >> authorized!"
>
> > > > Exactly, but you ask the user to present the token - on which you base
> > > > your decission.
> > > > in the @user.is_loggedin case, the user object can get that token from
> > > > the authority (and is thus acting as a proxy for auth).
>
> > > > In my opinion, using @auth or @user is not perse that one wins over
> > > > another - it depends on the philosphy and implementation behind it.
>
> > > > > Actually, if I'm KGB or CIA, and carry a weapon, I suppose I would 
> > > > > say "I
> > > > > decide I am authorized...", I just don't think that's the model 
> > > > > appropriate
> > > > > for web authentication ;-)
>
> > > > That's what happens if you use a framework you don;t trust or behave
> > > > badly yourself...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to