> 1) Sometimes we need to make more than fits in a lambda, i.e, work on
> more complex filtering, validate input args, etc.
>
So, instead of:
@make_member_of(db.person, 'just_males')
def get_just_people_who_are_male(self):
return self._db(self.gender == 'm').select()
you can do:
def get_just_people_who_are_male():
return db(db.person.gender == 'm').select()
db.person.just_males = get_just_people_who_are_male
Of course, in that case you can just call the function by itself without
assigning it to an attribute of the table. The decorator is nice too,
though.
I don't want to raise a flame, but models not being declared as
classes brings some pros and cons. Long live to monkey patching. ;-)
And for some more fun:
http://gluonframework.wordpress.com/2010/07/30/web2py-and-metaclasses/
Anthony
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.