Is test.html inside /views/default/? In that case, you need to do 
response.render('default/test.html',...) -- otherwise, if response.render 
can't find the view, I think it will just revert to the generic view.
 
Anthony

On Friday, June 24, 2011 7:35:25 AM UTC-4, apple wrote:

> Thanks. I am having a problem with response.render. Followed example 
> in the book but the controller below shows test.html but 
> response.render returns the generic view. Am I missing something? 
>
> def test(): 
>     customer = db.customer[1] 
>     html = response.render('test.html', dict(customer=customer)) 
>     f=open("c:/test.html", "w") 
>     f.write(html) 
>     f.close() 
>     return locals() 
>
> On Jun 23, 12:47 am, Anthony <[email protected]> wrote: 
> > If you want the html returned by a view, you can call 
> response.render(view, 
> > vars) directly (vars is a dictionary of variables to make available to 
> the 
> > view file). Seehttp://
> web2py.com/book/default/chapter/05#Using-the-Template-System-t...for 
> > an example. 
> > 
> > Note, there's also a 'generic.pdf' view in the 'welcome' app, and the 
> pyfpdf 
> > package in /gluon/contrib. Here's an example application using pyfpdf:
> http://code.google.com/p/pyfpdf/downloads/detail?name=web2py.app.fpdf.... 
> > There's alsohttps://github.com/lucasdavila/web2py-appreport. 
> > 
> > Anthony 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Wednesday, June 22, 2011 7:08:36 PM UTC-4, apple wrote: 
> > > I want to produce some invoices. I have a template created in Word and 
> > > saved as HTML. The template includes some tables and some placeholders 
> > > for data. The placeholders are in the web2py template format so I can 
> > > use python code to insert stuff like product lines programatically. 
> > > Magic! 
> > 
> > > So far so good but suppose I want to generate a PDF and email it to 
> > > customers. I have found a package (Pisa) that converts HTML to PDF. Is 
> > > there a way I can get at the web2py response before it is returned 
> > > from the controller to the browser?

Reply via email to