Ahh Anthony what would we do without you... tyvm... (again)

a few quick changes to code and works a charm...

Cheers
Greg

On Monday, 6 October 2014 00:48:09 UTC+10, Anthony wrote:
>
> Can you show your code? If you want to store a Python structure, you're 
> probably better off using a json field type, which will automatically 
> serialize back and forth between Python and JSON (the list:string type is 
> meant for storing a list of strings, not a list of Python lists).
>
> Anthony
>
> On Sunday, October 5, 2014 5:45:44 AM UTC-4, Greg Vaughan wrote:
>>
>> Hi Guys,
>>
>> I am using a list:string to store a list of lists. Each seperate list has 
>> 4 values, qty (int), name (string), description (text) and price(double). 
>> Stores nicely and looks fine in the db table eg.
>>
>> [1, 'OS 7030', 'OS 7030', 755.0], [3, 'SMT 24 Btn', 'SMT IP Phone', 
>> 360.0], [1, 'SMT IP', 'SMT IP Phone Licence', 70.0], [1, '2830 SIP Router', 
>> '2830', 499.0], [1, 'ADSL Central Filter ', 'ADSL Central Filter ', 61.5]
>>
>> However if I try to iterate and get some totals it is getting confused. 
>> For example the same list above becomes...
>>
>> ["[1, 'OS 7030', 'OS 7030', 755.0]", "[3, 'SMT 24 Btn', 'SMT IP Phone', 
>> 360.0]", "[1, 'SMT IP', 'SMT IP Phone Licence', 70.0]", "[1, '2830 SIP 
>> Router', '2830', 499.0]", "[1, 'ADSL Central Filter ', 'ADSL Central Filter 
>> ', 61.5]"]
>>
>> Iterating list[0] returns [ [ [ [ [  list[1] returns 1 3 1 1 1 list[2] , 
>> , , , , list[3] returns a list of the spaces, list[4] the apostrophes ' ' ' 
>> ' ' list[5] O S S 2 A etc etc...
>>
>> What do I have to change so that it is being interpreted correctly?
>>
>>
>>
>>
>>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to