Ah!

Of course.

Thanks Anthony!

I knew it was something dumb i did =)

-Mark

On Wed, Apr 6, 2016 at 11:35 AM, Anthony <[email protected]> wrote:

>     table = db.auth_user
>>     fields = ['id','first_name']
>>     fields.append('test_field_1')
>>
>>     query = table.id > 0
>>
>>     row = db(query).select(*fields).first().as_dict()
>>
>
> The problem is that you aren't passing the correct arguments to .select().
> You must pass Field objects, not simply the string names of the fields. So,
> it should be:
>
>     db(query).select(*[table[f] for f in fields]).first().as_dict()
>
> Now you will get a Row object with all the usual keys/values at the top
> level and no "_extra" sub-dictionary. In this case, the "T" and "F" values
> will be translated properly to True and False because now .select() knows
> the field types and does the proper parsing. When you simply pass field
> names to .select(), it doesn't have any information about the Field objects
> themselves -- it therefore doesn't know if a field is boolean and doesn't
> make the translation from "T"/"F" to True/False.
>
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/JlAzUE46s_M/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

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