On Saturday, January 27, 2018 at 10:31:13 AM UTC-5, Alfonso Serra wrote:
>
> Version 2.16.1-stable+timestamp.2017.11.14.05.54.25
>
> downloaded a few days ago. When i disable the routes on error all works 
> well.
>
> Not related but i have also ran into errors on sqlhtml.py line 1504
>  elif field.widget:
>       inp = field.widget(field, default)
>
> this trying to execute when default is None on a custom widget which looks 
> like:
> date_short = "%d/%m/%Y"
>
> def DateWidget(field, value):
>     if field.writable:
>         return TextWidget(field, value.strftime(date_short))
>     return value.strftime(date_short)
>
>
> patched as:
> elif default and field.widget
>
>
Rather than forking the framework, you should just fix your custom widget 
code to handle this case (that's how the web2py built-in widgets do it -- 
for example, look at the StringWidget code in sqlhtml.py).
 

> Not sure why SQLFORM is executing widgets when is not being used in a view 
> at all.
>

SQLFORM returns a FORM html helper, whether or not you actually use it to 
create HTML in the view. The reason is that the FORM helper is ultimately 
used to run the validations (the "requires" attributes from the DAL fields 
are transferred to the associated input, select, and textarea widgets in 
the form, which ultimately run the validations). SQLFORM is an abstraction 
built on top of FORM, so it uses FORM's built-in validation mechanism.

Anthony
 

-- 
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