On Friday, April 27, 2018 at 3:36:41 AM UTC-4, Alfonso Serra wrote:
>
> The auto id field, may not be a problem, i removed it for convenience for 
> a couple of reason:
> - iterate form.fields in the view to create the html. in this case was not 
> needed but also the special treatment as it should lie on hidden inputs.
>

You can instead iterate over form.custom.widget. It includes 'id' as a key 
as well, but its value is an empty string, so easy to conditionally exclude 
by checking that.
 

> - the type checking on this case was validating the id which was not part 
> of the factory declaration, not accepting the form. Ofc this could be 
> solved with some code refinement and leave everything how it is.
>

Not sure what workflow led to that, but I haven't seen any such issues with 
either SQLFORM or SQLFORM.factory.

Note, even with a standard SQLFORM based on a DAL table, "id" is included 
in form.fields even though it is not an input in the actual form nor 
processed upon form submission. I'm not sure if "id" serves any purpose in 
either case, but if we make a change, it should apply in all cases, not 
just SQLFORM.factory.
 

>  
>
>> We really don't want to try to replicate validation logic directly in the 
>> form methods -- you would not only need to validate the data but also 
>> provide a way to specify error messages as with the validators. It would be 
>> a big unnecessary mess.
>>
>
> Hmm i dont know if you would like this but i have also thought about it. 
> Validator's error messages could be done by web2py translator, kinda like 
> IS_DATE already does for date formats. If these messages are automated they 
> could be easily changed at the translation file instead of having to 
> declare them everytime on all the apps. Would also shorten the Fields 
> declarations this way.
>

That can already be done based on the default error messages associated 
with each validator (all validator error messages are passed to T() before 
being returned from the validator), but that is not a sufficient 
replacement for the current system, which allows custom messages to be 
associated with particular instances of particular validators dynamically.
 

> I have been recently involved in a project to translate a custom complex 
> app and been thinking on ways to improve web2py translator.
>

Probably worth a separate post in the web2py-developers Google group.

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