The mytables variable ony has values in steps 0,1 but you loop over it for
insert only in step 2 (when it is not defined). You do not get an error
probably because it already defined in the outer scope.
On Wednesday, 3 October 2012 06:23:36 UTC-5, Don_X wrote:
>
> Here is another controller I tried, and I still get the same results ( no
> data is recorder in the tables, no errors or ticket given ) and on the last
> submit button .. nothing happens :
>
>
> def register():
>> import os
>> STEPS = {0:
>> ('Iagreeto','first_name','last_name','email','email_check','password','sex','birth_date','usertype','user_adress','user_city','user_prov','user_postalcode','Country'),
>> 1:
>> ('the_user','user_speaks','more_Lang','user_image','user_picture','user_description','user_soccerstory'),
>>
>> # final step
>> 2: URL('user',args='profile')}
>>
>> step = int(request.args(0) or 0)
>> if not step in STEPS: redirect(URL(args=0))
>> fields = STEPS[step]
>> if step==0:
>> session.register = {}
>> if isinstance(fields,tuple):
>> mytables = ['auth_user','user_info']
>> form_fields = []
>> [form_fields.extend([db[t][f] for f in db[t].fields if f in
>> fields]) for t in mytables]
>> form = SQLFORM.factory(*form_fields)
>> if form.accepts(request,session):
>> session.register.update(form.vars)
>> redirect(URL(args=step+1))
>> else :
>> for k in mytables :
>> db[k].insert(**session.register)
>> session.flash = T('Signup completed')
>> redirect(fields)
>> return dict(form=form,step=step)
>>
>>
>
> Why the data entered by the user are not making it to the tables ??
> why no ticket or errors ? .. why no redirect is taking place ??
>
> thank you
>
> Don
>
--