OK, I finally got it to work.

Use 
db(db.table.id>0).select().as_list()

OR perform an Object update instead
rows.__dict__.update(r)

If there are better (or more correct/faster ways) to perform this behavior, 
I welcome your guidance and feedback. Thanks!



On Tuesday, August 21, 2012 11:26:18 PM UTC+8, lyn2py wrote:
>
> To clarify my abve post,
>
> I am using this code, and it fails without a ticket:
> def myfunc():
>   rows = db(db.table.id>0).select()
>
>   dummy = []
>   for r in rows:
>    if some_condition:
>       r.item=False
>       dummy.append(r)
>    else:
>       dummy.append(r)
>   return dummy
>
>
> And I get a not serializable when I use this code
> @service.json
> def myfunc():
>   rows = db(db.table.id>0).select()
>
>   dummy = []
>   for r in rows:
>    if some_condition:
>       r.item=False
>       dummy.append(r)
>    else:
>       dummy.append(r)
>   return dummy
>
>
>
>
> On Tuesday, August 21, 2012 10:54:46 PM UTC+8, Massimo Di Pierro wrote:
>>
>> Make sure you have the latest trunk. 
>>
>> On Tuesday, 21 August 2012 09:37:56 UTC-5, lyn2py wrote:
>>>
>>> When I perform:
>>>
>>> rows = db(db.table.id>0).select()
>>> return rows
>>>
>>> It is OK
>>>
>>> But when I perform:
>>> rows = db(db.table.id>0).select()
>>> dummy = []
>>> for r in rows:
>>>     if some_condition:
>>>         r.item=False
>>>         dummy.append(r)
>>>     else:
>>>         dummy.append(r)
>>> return dummy
>>>
>>> I get the not serializable error. What am I doing wrong?
>>>
>>

-- 



Reply via email to