>
> but I mean the field is empty / Null / None (type),
> which is translated by web2py into a string value 'None'.
>

None is translated into a string value as 'None' by Python, not web2py. If 
you want different behavior, you have to be explicit (no reason to assume 
the default behavior should be an empty string). You can achieve that by 
setting the represent attribute of the field:

Field('myfield', represent=lambda v, r: '' if v is None else v)

or more simply:

Field('myfield', map_none='')

Those methods will work in the grid and SQLFORMs, but not if you simply do 
{{=row.myfield}} somewhere. In that case, you would have to do something 
like {{=row.myfield or ''}}, or use the Rows.render() method to extract the 
row, which will automatically apply the "represent" function -- 
{{=rows.render(0).myfield}}.

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/groups/opt_out.

Reply via email to