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
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
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
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
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
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
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
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
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
9 matches
Mail list logo