Never in t2 but the user may want to do it. For example

db.define_table('person',
  SQLField('birthdate','date'),
  SQLField('age','integer'))

def compute_age(form):
  form.vars.age=(datetime.date.today()-form.vars.birthdate).years

t2.create(db.person,vars=compute_age)

On Oct 28, 7:47 am, billf <[EMAIL PROTECTED]> wrote:
> The python code in the subject appears in both T2.create() and
> t2.update().  Actually, the full code is:
>
>         if type(vars)==type(lambda:0): vars(form)
>         else: form.vars.update(vars)
>
> If I understand it correctly, its equivalent in pseudo code is:
>
> if vars is a function then call the function passing form as an
> argument
> else add vars (assumes it's a dict?) to the dict form.vars
>
> Assuming that interpretation is correct, is vars ever passed in the
> form of a function? when/why would it be used?
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to