Not a bug. I think @service.csv sets the content-type of the response to 
'text/x-csv', so that will likely prompt the browser to do a download 
rather than display the text (which is typically what is desired). Have you 
tried it with D3 to see if it works as is?

Anthony

On Tuesday, June 25, 2013 10:05:27 AM UTC-4, greaneym wrote:
>
> Thanks for the answers Anthony, I am going to try to report a bug.
> I am using 
> web2py 
> 2.4.6-stable+timestamp.2013.04.06.17.37.38
> the source version, 
> on mac os
> and 
>
> when I copy and paste the csv as a service example from the book
> section on Remote procedure calls,
> to the default.py in the welcome application, and then run
> the example to show the service, which I think is supposed to echo,
> hello world
> 1,2
>
> instead the application opens my Download application and creates a 
> download file containing the hello world 1,2.
>
> I am reporting this because I think the browser instead is supposed to 
> display the text.
>
> How do I fix this please?
>
> The json as a web service works fine.
>
> thanks,
> Margaret
>
> I will look on github to see where to report the possible bug.
>
>
> On Monday, June 24, 2013 5:10:58 PM UTC-5, Anthony wrote:
>>
>> The method I first pointed out might be easier: 
>> http://web2py.com/books/default/chapter/29/10#CSV
>>
>> def csvtab():
>>>     rows = db(db.ptoday.id>0).select( ).as_list()
>>>     for row in rows:
>>>       data = row.csvdata
>>>
>>
>> Note, .as_list() converts the Rows object to a list of dictionaries, so 
>> you cannot then do row.csvdata, because row is just a standard dict at that 
>> point (so it would be row['csvdata']). Anyway, .as_list() is not necessary 
>> here.
>>  
>>
>>>       ddata = ''.join(line.replace('\n', '\n') for line in data)
>>>     return data
>>>
>>> @service.csv
>>> def exposed():
>>>    mytable = csvtab()
>>>
>>
>> The above is not how you would do a csv service in web2py. Please read 
>> the book section on this for the proper code: 
>> http://web2py.com/books/default/chapter/29/10#Remote-procedure-calls.
>>
>> Anthony
>>
>

-- 

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


Reply via email to