Thank you.  So is there a way to run a post process after SQLFORM.factory 
or do I simply keep the code within the original function because this 
seems to work...

def brand():
  if request.args(0) == 'register':

    form = SQLFORM.factory(db.auth_user,db.brands,
        fields=['brand_name', 'brand_logo', 'first_name','last_name','email'
,'password'], onaccept=_register_brand)
    
    if form.process(keepvalues=True).accepted:
      db.auth_user.update_or_insert(**db.auth_user._filter_fields(form.vars
))
      brandID = db.brands.update_or_insert(**db.brands._filter_fields(form.
vars))
      form.vars.brandID=brandID
      response.flash = 'form accepted'
    elif form.errors:
      response.flash = 'form has errors'
    
    return dict(form=form)


On Friday, March 20, 2015 at 5:50:13 PM UTC-5, Niphlod wrote:
>
> There are a few errors in the code, and in the assumptions you are doing:
>
> - SQLFORM.factory doesn't do any db I/O, so process() doesn't actually 
> store anything
> - either you use form.process().accepted or form.accepts(request, session)
> - you're hacking auth.forms, which is undocumented and unpredictable. I'm 
> not sure auth.settings.register_onaccept is firing inside a custom 
> SQLFORM.factory
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.

Reply via email to