Re: reportlab - filename of generated PDF

2009-01-26 Thread Ivan Mincik

On Monday 26 January 2009, Vinay Sajip wrote:
> 
> On Jan 26, 7:59 am, Ivan Mincik  wrote:
> > Dear django users,
> > we have a problem with filename of resulting PDF generated by reportlab and 
> > then downloaded by browser.
> >
> > Generated PDF is OK, but filename is incorrect. It is allways something 
> > like "randomstring.pdf.part". (for example sa34sdfasdf.pdf.part)
> >
> > in the "view.py" there are these lines:
> > response = HttpResponse(mimetype='application/pdf')
> > response['Content-Disposition'] = 'filename=gisplan.pdf'
> >
> > Please, can anybody see where can be the problem ?
> 
> It looks like a temporary filename generated by whatever is
> downloading the file. For example, Firefox, while downloading, would
> name the file "gisplan.pdf.part" and rename it to "gisplan.pdf" after
> the download completed. If the downloader completed the download
> (accounting for the OK PDF file) but failed to rename it, you might
> get the result which you observed.
> 
> I use a slightly different content-disposition, indicating explicitly
> that it's an attachment:
> 
> response['Content-Disposition'] = 'attachment; filename=gisplan.pdf'
> 
> With this approach, everything works as expected for me.
Thanks, 
it is working now.

> 
> Regards,
> 
> Vinay Sajip
> > 
> 



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: reportlab - filename of generated PDF

2009-01-26 Thread Vinay Sajip



On Jan 26, 7:59 am, Ivan Mincik  wrote:
> Dear django users,
> we have a problem with filename of resulting PDF generated by reportlab and 
> then downloaded by browser.
>
> Generated PDF is OK, but filename is incorrect. It is allways something like 
> "randomstring.pdf.part". (for example sa34sdfasdf.pdf.part)
>
> in the "view.py" there are these lines:
> response = HttpResponse(mimetype='application/pdf')
> response['Content-Disposition'] = 'filename=gisplan.pdf'
>
> Please, can anybody see where can be the problem ?

It looks like a temporary filename generated by whatever is
downloading the file. For example, Firefox, while downloading, would
name the file "gisplan.pdf.part" and rename it to "gisplan.pdf" after
the download completed. If the downloader completed the download
(accounting for the OK PDF file) but failed to rename it, you might
get the result which you observed.

I use a slightly different content-disposition, indicating explicitly
that it's an attachment:

response['Content-Disposition'] = 'attachment; filename=gisplan.pdf'

With this approach, everything works as expected for me.

Regards,

Vinay Sajip
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



reportlab - filename of generated PDF

2009-01-25 Thread Ivan Mincik

Dear django users,
we have a problem with filename of resulting PDF generated by reportlab and 
then downloaded by browser.  

Generated PDF is OK, but filename is incorrect. It is allways something like 
"randomstring.pdf.part". (for example sa34sdfasdf.pdf.part)


in the "view.py" there are these lines: 
response = HttpResponse(mimetype='application/pdf')
response['Content-Disposition'] = 'filename=gisplan.pdf'

Please, can anybody see where can be the problem ?


Ivan

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---