[web2py] Re: tab separated csv file

2013-01-07 Thread rāma
I think the import button should have a delimiter field makes things easier.

On Thursday, 12 March 2009 00:08:27 UTC+8, mdipierro wrote:
>
> There is no configuration parameter to do so. You mat create your own 
> csv serializer. look into the python csv module. 
>
> On Mar 11, 10:01 am, Marco Prosperi  
> wrote: 
> > hello everybody, 
> > how can I change the following function (defined in appadmin.py 
> > controller) so that the downloaded file has tab separated values 
> > instead of comma separated? Or do I have to change some settings 
> > somewhere? 
> > 
> > thanks in advance, 
> > Marco 
> > 
> > def csv(): 
> > import gluon.contenttype 
> > response.headers['Content-Type'] = \ 
> > gluon.contenttype.contenttype('.csv') 
> > db = get_database(request) 
> > query = get_query(request) 
> > if not query: 
> > return None 
> > response.headers['Content-disposition'] = \ 
> > 'attachment; filename=%s_%s.csv'\ 
> >  % tuple(request.vars.query.split('.')[:2]) 
> > return str(db(query).select())

-- 





[web2py] Re: tab separated csv file

2013-01-08 Thread Derek
in sqlhtml there is a TSV exporter though...

On Wednesday, March 11, 2009 9:08:27 AM UTC-7, mdipierro wrote:
>
> There is no configuration parameter to do so. You mat create your own 
> csv serializer. look into the python csv module. 
>
> On Mar 11, 10:01 am, Marco Prosperi  
> wrote: 
> > hello everybody, 
> > how can I change the following function (defined in appadmin.py 
> > controller) so that the downloaded file has tab separated values 
> > instead of comma separated? Or do I have to change some settings 
> > somewhere? 
> > 
> > thanks in advance, 
> > Marco 
> > 
> > def csv(): 
> > import gluon.contenttype 
> > response.headers['Content-Type'] = \ 
> > gluon.contenttype.contenttype('.csv') 
> > db = get_database(request) 
> > query = get_query(request) 
> > if not query: 
> > return None 
> > response.headers['Content-disposition'] = \ 
> > 'attachment; filename=%s_%s.csv'\ 
> >  % tuple(request.vars.query.split('.')[:2]) 
> > return str(db(query).select())

-- 





[web2py] Re: tab separated csv file

2013-01-08 Thread Derek
You could monkey-patch the dal 'rows' object __str__ by making it export as 
a TSV.

On Wednesday, March 11, 2009 8:01:42 AM UTC-7, Marco Prosperi wrote:
>
> hello everybody, 
> how can I change the following function (defined in appadmin.py 
> controller) so that the downloaded file has tab separated values 
> instead of comma separated? Or do I have to change some settings 
> somewhere? 
>
> thanks in advance, 
> Marco 
>
> def csv(): 
> import gluon.contenttype 
> response.headers['Content-Type'] = \ 
> gluon.contenttype.contenttype('.csv') 
> db = get_database(request) 
> query = get_query(request) 
> if not query: 
> return None 
> response.headers['Content-disposition'] = \ 
> 'attachment; filename=%s_%s.csv'\ 
>  % tuple(request.vars.query.split('.')[:2]) 
> return str(db(query).select())

-- 





[web2py] Re: tab separated csv file

2013-01-08 Thread Massimo Di Pierro
Nooo. This would break other apps in the same server.

I would take a patch to pass the parameter around or use the grid exporter 
in appadmin.

On Tuesday, 8 January 2013 12:52:38 UTC-6, Derek wrote:
>
> You could monkey-patch the dal 'rows' object __str__ by making it export 
> as a TSV.
>
> On Wednesday, March 11, 2009 8:01:42 AM UTC-7, Marco Prosperi wrote:
>>
>> hello everybody, 
>> how can I change the following function (defined in appadmin.py 
>> controller) so that the downloaded file has tab separated values 
>> instead of comma separated? Or do I have to change some settings 
>> somewhere? 
>>
>> thanks in advance, 
>> Marco 
>>
>> def csv(): 
>> import gluon.contenttype 
>> response.headers['Content-Type'] = \ 
>> gluon.contenttype.contenttype('.csv') 
>> db = get_database(request) 
>> query = get_query(request) 
>> if not query: 
>> return None 
>> response.headers['Content-disposition'] = \ 
>> 'attachment; filename=%s_%s.csv'\ 
>>  % tuple(request.vars.query.split('.')[:2]) 
>> return str(db(query).select())
>
>

--