I do not understand the code in the manual and what I have seen on
this list about csv-downloads.

I don't have a problem to do csv-export from the commandline in a
shell.  I just cannot figure out how the examples I referred to work
in a MVC -environment.

Take for example this export function (taken from a mail in this list):

def export():
   import cStringIO
   s = cStringIO.StringIO()
   db.export_to_csv_file(s)
   response.headers['Content-Type'] = 'text/csv'
   return s.getvalue()

My problem is that I do not understand what it does - especially the
"s=cStringIO.String(IO()" part.

Can somebody explain to me where does 's' get it's content from?

I know on the commandline I can do:
records = db(query).select(db.table())
and then records.export_to_csv_file(open('somefile','w')).

Say I have a set of records (result of a query) which the user can see
in a view and the user wants to download that selection of records.
The link refer to this 'export' controller.  How do I do it?

I would like to see an example of how to set the link up in the view
an how the above controller is called in such a way that the user can
download the file or open it in some program able to read csv-files.

Regards
Johann
-- 
"Finally, brethren, whatsoever things are true,  whatsoever things are
honest, whatsoever things are  just, whatsoever things are pure,
whatsoever things  are lovely, whatsoever things are of good report;
if there be any virtue, and if there be any praise, think on these
things."    Philippians 4:8


-- 
To unsubscribe, reply using "remove me" as the subject.

Reply via email to