On Sunday, August 18, 2013 10:21:51 PM UTC-7, Joe Barnhart wrote: > Ah. That explains one mystery. I knew about setting the formname in the > SQLFORM call, but I had not noticed I needed to pass it in the "validate" > method as well. >
SQLFORM.__init__ does not take a "formname" argument (you won't get an error, though, because it includes a **attributes argument, so if you include "formname", it will just be ignored). To set the formname, you specify the "formname" argument to .accepts() (or .validate or .process, which end up calling .accepts). > That form code is pretty hard to follow. If you start with an SQLFORM and > call validate(), the call goes to FORM.validate() which then calls > self.accepts(), meaning SQLFORM.accepts() in this case, which then calls > FORM.accepts(). We do this kind of stuff all the time in Smalltalk but I'm > not accustomed to seeing it in Python! > Originally there was just .accepts(). .validate() and .process() were added later, but .accepts had to remain in order to maintain backward compatibility, hence the somewhat convoluted logic. The only difference between .validate() and .process() is that the latter returns the form object rather than a True/False value, and .process() defaults to dbio=True in the case of a SQLFORM. 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.

