>
> def register():
>     """ 
>     exposes: 
>     http://..../[app]/account/register 
>     """ 
>     form = auth.register() 
>     if form.process().accepted: 
>         session.email = form.vars.email 
>         session.password = form.vars.password 
>         redirect(URL('registered')) 
>
>     return dict(form=form)
>
>
> Don't do the subsequent form.process(). auth.register() already handles 
the form processing, so you are doing it a second time. Instead, if there's 
something you want to do after registration is successful, you should 
register an auth.settings.register_onaccept callback function (see 
http://web2py.com/books/default/chapter/29/9#Settings-and-messages).

I suspect the email send is actually failing and the initial db insert is 
getting rolled back as usual. But by calling form.process() again, you are 
re-inserting the record. Also, although response.flash was set to the error 
message, your redirect causes response.flash to be reset (if you want a 
flash message to survive a redirect, you have to set session.flash). This 
doesn't tell us why the mail is failing to send, but it indicates why 
you're not seeing the usual results of a failure.

Anthony

Reply via email to