librelist archives

« back to archive

Returning a rendered file without having the html/head tags

Returning a rendered file without having the html/head tags

From:
Mmn
Date:
2012-05-12 @ 13:50
Hello folks,

I am pretty new to flask, so this question might seem kind of stupid, but I
couldn't find anything in the documentation.

I am trying to use dojo as my UI framework and on load of a page I can
split up the tabs into various link panes (
http://dojotoolkit.org/reference-guide/1.7/dijit/layout/LinkPane.html).
So I saved the content I need to load inside my html page in a different
template file and made a url for flask to render it. When I make the
call(return render_template('customercontacteditpane.html')) though, flask
seems to be adding a html, head tags to it and returning it as an html
response. So the whole rendering fails as this gets replaced as the
response. This is what I saw happening in firebug.

Now if I put the same template in the static folder and get it, I am fine
with my rendering, but as expected the data which comes from flask
rendering is absent.

Can you please help me understand what I can do to accomplish this?

Regards,
-- 
--
It’'s a fact, taller people sleep longer in bed.

Re: [flask] Returning a rendered file without having the html/head tags

From:
Simon Sapin
Date:
2012-05-13 @ 08:09
Le 12/05/2012 15:50, MMN a écrit :
> So I saved the content I need to load inside my html page in a different
> template file and made a url for flask to render it. When I make the
> call(return render_template('customercontacteditpane.html')) though,
> flask seems to be adding a html, head tags to it and returning it as an
> html response. So the whole rendering fails as this gets replaced as the
> response. This is what I saw happening in firebug.

Hi,

I am not aware of anything in Flask that would add HTML that you have 
not written to your responses. But I don’t understand what you’re doing 
either. Could you provide a minimal code sample, what you expected to 
see when running it, and what you see instead?

Regards,
-- 
Simon Sapin

Re: [flask] Returning a rendered file without having the html/head tags

From:
Qiang Wang
Date:
2012-05-13 @ 08:46
maybe you can use flask's response object to do this
在 2012-5-12 下午9:53,"MMN" <mmn007@gmail.com>写道:

> Hello folks,
>
> I am pretty new to flask, so this question might seem kind of stupid, but
> I couldn't find anything in the documentation.
>
> I am trying to use dojo as my UI framework and on load of a page I can
> split up the tabs into various link panes (
> http://dojotoolkit.org/reference-guide/1.7/dijit/layout/LinkPane.html).
> So I saved the content I need to load inside my html page in a different
> template file and made a url for flask to render it. When I make the
> call(return render_template('customercontacteditpane.html')) though, flask
> seems to be adding a html, head tags to it and returning it as an html
> response. So the whole rendering fails as this gets replaced as the
> response. This is what I saw happening in firebug.
>
> Now if I put the same template in the static folder and get it, I am fine
> with my rendering, but as expected the data which comes from flask
> rendering is absent.
>
> Can you please help me understand what I can do to accomplish this?
>
> Regards,
> --
> --
> It’'s a fact, taller people sleep longer in bed.
>