Done!

 Issue 738 <http://code.google.com/p/web2py/issues/detail?id=738>:unable to
parse csv file 'NoneType' object is unsubscriptable with list:reference
type field

Thanks

Richard

On Wed, Mar 28, 2012 at 9:34 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Please open a ticket.
>
>
> On Tuesday, 27 March 2012 16:04:47 UTC-5, Richard wrote:
>>
>> Same thing with trunk...
>>
>> Richard
>>
>> On Tue, Mar 27, 2012 at 3:52 PM, Richard <ml.richard.vez...@gmail.com>wrote:
>>
>>> This one to : https://groups.google.com/**forum/?fromgroups#!topic/**
>>> web2py/H_QqV2g8IgQ<https://groups.google.com/forum/?fromgroups#!topic/web2py/H_QqV2g8IgQ>
>>>
>>> I experimented the problem with 1.99.4 and 1.99.7
>>>
>>> What I understand so far is that id_map get None by default, so when it
>>> get here :
>>>
>>> [id_map[ref_table][int(v)] \
>>>                              for v in bar_decode_string('|35|1|')]
>>>
>>> It clears that it will raise the exception...
>>>
>>> I try to call my import function like this :
>>>
>>> def import_csv(table, file):
>>>     table.import_from_csv_file(**file, id_map = {})
>>>
>>> Noting better.
>>>
>>> Please help.
>>>
>>> Richard
>>>
>>>
>>> Le mardi 27 mars 2012 15:45:50 UTC-4, Richard a écrit :
>>>
>>>> Seems related : https://groups.google.com/**fo**rum/#!topic/web2py/**
>>>> nYKsFPumXk0<https://groups.google.com/forum/#!topic/web2py/nYKsFPumXk0>
>>>>
>>>>
>>>>
>>>> Le mardi 27 mars 2012 15:20:27 UTC-4, Richard a écrit :
>>>>>
>>>>> Hello,
>>>>>
>>>>> Is it possible the table csv import method be broken?
>>>>>
>>>>> When I use list:reference type field I can't import back a exported
>>>>> CSV with the appadmin.
>>>>>
>>>>> I don't understand where the None value could come from...
>>>>>
>>>>> When I try to implement my own csv import function base on this thread
>>>>> : https://groups.google.com/**fo**rum/?fromgroups#!topic/**web2py/**
>>>>> lDi0lLK_Wm0<https://groups.google.com/forum/?fromgroups#!topic/web2py/lDi0lLK_Wm0>
>>>>>
>>>>> That work fine, until I try to import data with list:reference type
>>>>> field (|id| or |id|id|, etc.)
>>>>>
>>>>> I get this traceback :
>>>>>
>>>>> for v in bar_decode_string(value)]
>>>>>
>>>>> TypeError: 'NoneType' object is unsubscriptable
>>>>>
>>>>>
>>>>>    -
>>>>>
>>>>>
>>>>>  Function argument list
>>>>>
>>>>> (field=<gluon.dal.Field object>, value='|35|1|', id_map=None)
>>>>>  Code listing
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> 5683.
>>>>> 5684.
>>>>> 5685.
>>>>> 5686.
>>>>> 5687.
>>>>>
>>>>>
>>>>> 5688.
>>>>>
>>>>> 5689.
>>>>> 5690.
>>>>> 5691.
>>>>> 5692.
>>>>>
>>>>>             elif field.type.startswith('list:**st**ring'):
>>>>>
>>>>>
>>>>>                 value = bar_decode_string(value)
>>>>>
>>>>>
>>>>>             elif field.type.startswith(list_**ref**erence_s):
>>>>>
>>>>>
>>>>>                 ref_table = field.type[len(list_reference_****s):].strip()
>>>>>
>>>>>
>>>>>                 value = [id_map[ref_table][int(v)] \
>>>>>
>>>>>
>>>>>
>>>>>                              for v in bar_decode_string(value)]
>>>>>
>>>>>
>>>>>             elif field.type.startswith('list:')****:
>>>>>
>>>>>
>>>>>                 value = bar_decode_integer(value)
>>>>>
>>>>>
>>>>>             elif id_map and field.type.startswith('**referen**ce'):
>>>>>
>>>>>
>>>>>                 try:
>>>>>
>>>>>  Variables  global bar_decode_string <function bar_decode_string>
>>>>> value '|35|1|' v '35'
>>>>>
>>>>> What is exactly id_map?
>>>>>
>>>>> I think problem is coming from there...
>>>>>
>>>>> Thanks
>>>>>
>>>>> Richard
>>>>>
>>>>
>>

Reply via email to