Apparently there's a bug with IE whereby Vary will hurt Acrobat's ability to view pdfs. Since Vary is ingrained into the souls of many of Django's middleware, I have provided an additional middleware which deletes Vary in times when IE might break because of it. FixIEVaryBugMiddleware is available at http://www.djangosnippets.org/snippets/157/
Hope this helps you, Mike Axiak On Apr 4, 11:41 pm, queezy <[EMAIL PROTECTED]> wrote: > Ah, the light just went on (finally!). I will put the http variable in > where pdfbytes is found. > > Thanks Malcolm! > > Cheers! > > -Warren > > ----- Original Message ----- > From: "Malcolm Tredinnick" <[EMAIL PROTECTED]> > To: <django-users@googlegroups.com> > Sent: Wednesday, April 04, 2007 6:50 PM > Subject: Re: Django app serves PDFs but browser doesn't render them > > > On Wed, 2007-04-04 at 18:46 -0700, queezy wrote: > >> Hi Malcolm! > > >> Actually I tried the following (and gave Ned credit for solving half of > >> my > >> problem): > > >> from django.http import HttpResponse > >> from django.shortcuts import render_to_response > >> import urllib > > >> def front(request): > >> sock = > >> urllib.urlopen("/home2/a12007/webapps/officeprofiler/profiler/templates/officechoice.html") > >> html = sock.read() > >> sock.close() > >> return HttpResponse(html) > > >> def officereport(request): > >> selected_choice = request.POST['office'] > >> sock = > >> urllib.urlopen("/home2/a12007/webapps/officeprofiler/profiler/"+selected_choice) > >> html = sock.read() > >> sock.close() > >> # response = HttpResponse(pdfbytes, mimetype='application/pdf') > >> response['Content-Disposition'] = 'attachment; > >> filename='+selected_choice > >> return response > > >> When I comment out the attachment statement, so thepdfis to be viewed, > >> it > >> doesn't work. However, when I comment out the non-attachment version, I > >> get > >> the download box. That is why previously I said that it solved half of > >> my > >> problem. > > >> That is the case at WebFaction hosting. When I am at work on a Linux > >> server > >> there it tells me that "pdfbytes" is undefined. > > > That's because it is undefined. Where are you creating the "pdfbytes" > > variable? Do you mean to use the "html" variable there? The error > > message is telling you exactly what is wrong here. > > > Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---