[web2py] Re: Book 6.8. Exporting and Importing Data ( CSV and remote Database Synchronization )

2010-03-06 Thread raven
The above changes get the code in the book to work. However, the default name for the downloaded csv file is rather awkward. If you add this line response.headers["Content-Disposition"] = "attachment;filename=myfname.csv" just after response.headers['Content-Type'] = 'text/csv' then you

Re: [web2py] Re: Book 6.8. Exporting and Importing Data ( CSV and remote Database Synchronization )

2010-02-12 Thread Thadeus Burgess
Ah sure did, my bad. Sorry -Thadeus On Fri, Feb 12, 2010 at 10:48 AM, raven wrote: > I see the problem.  You misread the code I posted. > >    import cStringIO >    s = cStringIO.StringIO() >          ^ c missing from book >                         ^ no leading c, neither in book nor my code

[web2py] Re: Book 6.8. Exporting and Importing Data ( CSV and remote Database Synchronization )

2010-02-12 Thread raven
I see the problem. You misread the code I posted. import cStringIO s = cStringIO.StringIO() ^ c missing from book ^ no leading c, neither in book nor my code On Feb 12, 11:02 am, Thadeus Burgess wrote: > No its not missing the leading c. There is no le

[web2py] Re: Book 6.8. Exporting and Importing Data ( CSV and remote Database Synchronization )

2010-02-12 Thread mdipierro
cStringIO.StringIO not cStringIO.cStringIO On Feb 12, 10:03 am, Thadeus Burgess wrote: > Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15) > [GCC 4.4.1] on linux2 > Type "help", "copyright", "credits" or "license" for more information.>>> > import cStringIO > >>> cStringIO.cStringIO > > Traceba

[web2py] Re: Book 6.8. Exporting and Importing Data ( CSV and remote Database Synchronization )

2010-02-12 Thread raven
Thadeus, Thank you for your interest. I pasted the code directly from my working application - I see no complaints about cStringIO. On Feb 12, 11:02 am, Thadeus Burgess wrote: > No its not missing the leading c. There is no leading c. Try importing > cStringIO.cStringIO and see the stacktrace co

Re: [web2py] Re: Book 6.8. Exporting and Importing Data ( CSV and remote Database Synchronization )

2010-02-12 Thread Thadeus Burgess
Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15) [GCC 4.4.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import cStringIO >>> cStringIO.cStringIO Traceback (most recent call last): File "", line 1, in AttributeError: 'module' object has no attribute 'cStr

Re: [web2py] Re: Book 6.8. Exporting and Importing Data ( CSV and remote Database Synchronization )

2010-02-12 Thread Thadeus Burgess
No its not missing the leading c. There is no leading c. Try importing cStringIO.cStringIO and see the stacktrace complaining there is no cStringIO module in the cStringIO package. -Thadeus On Fri, Feb 12, 2010 at 9:19 AM, raven wrote: > In the export controller > > * need to import cStringI

[web2py] Re: Book 6.8. Exporting and Importing Data ( CSV and remote Database Synchronization )

2010-02-12 Thread raven
In the import controller * underscores are missing from the form attributes * The code tries to update EVERY table in db - and fails because they do not all have uuid fields. def importandsync(): form = FORM(INPUT(_type='file', _name='data'), INPUT(_type='submit')) if form.accepts(reque

[web2py] Re: Book 6.8. Exporting and Importing Data ( CSV and remote Database Synchronization )

2010-02-12 Thread raven
In the export controller * need to import cStringIO * cStringIO is missing leading c def export(): import cStringIO s = cStringIO.StringIO() db.export_to_csv_file(s) response.headers['Content-Type'] = 'text/csv' return s.getvalue() -- You received this message because you a