(Changed the subject - I realized hijacking old thread isn't helping me get responses)
More debugging : I tried the code from "Docs and Example" page, appreport's Wiki ( https://github.com/lucasdavila/web2py-appreport/wiki/Docs-and-examples) Specifically example starting w/ "or, rendering a web2py view (**like mvc**)" (Only change, instead of person table, I used one of my existing table) I see same behaviour - i.e. I successfully get the PDF report, but the form in browser is in weird state. Also copying Lucas. BTW, I'm seeing this problem on both 2.0.8 and 2.2.1 version of web2py -Mandar On Thursday, November 22, 2012 8:28:06 PM UTC+5:30, Mandar Vaze wrote: > > I did some debugging using firebug - Here is what is happening : > > When I choose HTML report there is a POST (posts form data - essentially > filters selected by user) followed by GET (actual HTML page is returned > from the template) > But when I choose PDF report - I don't see any POST/GET in the firebug. > (But PDF is indeed returned to the browser) > Now that form is in weird state, if I click Submit one more time, I get > POST, GET and another POST in firebug, but user doesn't see anything. > > Do I need to return 200-OK (equivalent) when I return PDF data via > appreport ? > > Please help > > -Mandar > > > On Thursday, November 22, 2012 7:00:32 PM UTC+5:30, Mandar Vaze wrote: >> >> return response.stream(open(request.folder+'/static/temp.pdf', >>> 'rb'),chunk_size=4096) >>> # pdf.output(pfile, 'F') >>> redirect(URL("index")) >>> >> >> Will the execution ever reach redirect statement above ? >> I'm interested because I have a report page which generates the reports >> based on form submit. >> User also has option to show PDF report (checkbox) >> I use appreport plugin to return the PDF. My code looks something like >> this ... >> >> return_dict = dict(key1=val1, key2=val2) #Some values that make send >> to the template >> if pdfreport is not None and pdfreport == 'on': >> html = response.render('default/pdfreport.html', return_dict) >> pdfName = "mypdfname.pdf" >> return plugin_appreport.REPORTPISA(html=html, >> response_filename=pdfName) >> else: >> return return_dict >> >> Here is the problem : >> >> When I use HTML report (last statement after else) - user is shown a >> different page, but when I select and return PDF report, use stays on the >> same page, but the "form" is in some weird state. i.e user can click >> "submit" again but nothing happens till user "refreshes" the page. >> >> I had something like the above in mind, where user is redirected to the >> "same" page, but the page is refreshed - AFTER pdf is returned to the user. >> But I don't think any code after "return" would work. >> >> Any work around to redirect the user after PDF is returned (via >> appreport?) >> >> Thanks, >> -Mandar >> >> --