Re: [web2py] convert request.vars to set default value in a custom .factory() form

2016-11-04 Thread Richard Vézina
Will see, if I can make a simplified version, that long... I appreciate your help Richard On Thu, Nov 3, 2016 at 10:01 PM, Anthony wrote: > On Thursday, November 3, 2016 at 4:10:04 PM UTC-4, Richard wrote: >> >> I can show you privately... >> > > Or maybe create a simplified example that demon

Re: [web2py] convert request.vars to set default value in a custom .factory() form

2016-11-03 Thread Anthony
On Thursday, November 3, 2016 at 4:10:04 PM UTC-4, Richard wrote: > > I can show you privately... > Or maybe create a simplified example that demonstrates the problem. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - htt

Re: [web2py] convert request.vars to set default value in a custom .factory() form

2016-11-03 Thread Richard Vézina
I can show you privately... Richard On Thu, Nov 3, 2016 at 12:13 PM, Anthony wrote: > Can you show your code? It is not clear why you can't use the "keepvalues" > argument. Please explain the workflow in more detail. > > > On Tuesday, November 1, 2016 at 10:45:45 AM UTC-4, Richard wrote: >> >>

Re: [web2py] convert request.vars to set default value in a custom .factory() form

2016-11-03 Thread Anthony
Can you show your code? It is not clear why you can't use the "keepvalues" argument. Please explain the workflow in more detail. On Tuesday, November 1, 2016 at 10:45:45 AM UTC-4, Richard wrote: > > Hello, > > I have an high customized SQLFORM.factory() form... I set default value > for the upda

Re: [web2py] convert request.vars to set default value in a custom .factory() form

2016-11-03 Thread Richard Vézina
The above not handle bool correctly : def controller_func(): ... field_type_mapping = \ {'id': 'int', 'reference': 'int', 'boolean': 'bool', 'string': 'str', 'decimal': 'decimal', 'date': 'date', 'datetime': 'datetime'}

Re: [web2py] convert request.vars to set default value in a custom .factory() form

2016-11-03 Thread Richard Vézina
I come up with this : def convert(value, type_): import importlib try: # Check if it's a builtin type module = importlib.import_module('__builtin__') cls = getattr(module, type_) except AttributeError: # if not, separate module and class module,

[web2py] convert request.vars to set default value in a custom .factory() form

2016-11-01 Thread Richard
Hello, I have an high customized SQLFORM.factory() form... I set default value for the update form for which I have no problem with values types as they get out of the database... But in case I want to emulate keepvalue feature with this form I need to pass value to request.vars which I need to