Thank you very much, this definitely is helping me peel the onion and get at the core; I should have definitely looked further past accepts. I noticed that the function widget() isn't required for widgets as is the case for AutocompleteWidget<http://web2py.com/examples/static/epydoc/web2py.gluon.sqlhtml.AutocompleteWidget-class.html> or any of the widgets in web2py plugins (that has been down for a while now, btw, really excited about what you guys are brewing!) and was wondering where it was required.
>From what I understand you are now telling me and looking at the code, the widget function should not be implemented by me if I were to make a new widget as it is solely used by web2py internals in such cases as SQLFORM. The only time I can fathom implementing it is in extending SQLFORM. Again, thank you! On Wed, Jul 10, 2013 at 8:17 PM, Anthony <[email protected]> wrote: > On Wednesday, July 10, 2013 7:28:49 PM UTC-4, Mark Finkelstein wrote: > >> I noticed that widget objects extending FormWidget are required to >> implement widget(), but couldn't find a place where that function is used. >> I was wondering what it would be for as it does not seem necessary for >> implementing widgets. > > > The various widget classes are assigned to a Storage object, > SQLFORM.widgets<https://code.google.com/p/web2py/source/browse/gluon/sqlhtml.py#857>. > The "widget" class methods are then used in this > section<https://code.google.com/p/web2py/source/browse/gluon/sqlhtml.py#1064>of > the SQLFORM code (e.g., self.widgets.boolean.widget). > > >> I was also wondering where validators are processed. I could not find >> where, but going through process() I found it goes on to validate() and >> onto accepts(), but nowhere did I find code checking the validators. >> > > FORM.accepts calls the > ._traverse<https://code.google.com/p/web2py/source/browse/gluon/html.py#2014>method, > which is then called > recursively<https://code.google.com/p/web2py/source/browse/gluon/html.py#846>over > the form DOM. The > ._validate<https://code.google.com/p/web2py/source/browse/gluon/html.py#853>method > is then called, and when applied to widgets such as INPUT and > SELECT, it applies the validators (e.g., INPUT > validation<https://code.google.com/p/web2py/source/browse/gluon/html.py#1758> > ). > > For SQLFORMs, when the widgets are created for each field, the > field.requires attribute is transferred to the > widget<https://code.google.com/p/web2py/source/browse/gluon/sqlhtml.py#125>, > so the validators become part of the widget (and are therefore processed > when the widget's ._validate method is called, as described above). > > So, as you can see, it's really all quite clear and straightforward. ;-) > > Anthony > > -- > > --- > You received this message because you are subscribed to a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/S9CpyWiGvCc/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- --- 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.

