librelist archives

« back to archive

Flask Quoting Everything on Returns from Requests

Flask Quoting Everything on Returns from Requests

From:
Michael Johnston
Date:
2012-05-26 @ 14:16
I'm a newbie to Python and Flask and have been having a ball with both. 
Flask just never seems to get in my way, and it always seems to provide 
the functionality I need just when I need it. One thing that is puzzling 
me, however, is how quotes are handled. I've been unable to find the 
answer to this one in the documentation, but it's such an irritating 
problem that I'm sure I've just overlooked something fundamental: request 
responses are being wrapped in quotes. 

For example, lets say I return the following:

<p>Hello World</p>


What gets sent to the browser is:


"<p>Hello World</p>"


What am I doing wrong?

Re: [flask] Flask Quoting Everything on Returns from Requests

From:
Steven Kryskalla
Date:
2012-05-26 @ 14:30
On Sat, May 26, 2012 at 7:16 AM, Michael Johnston <mikej165@gmail.com> wrote:
> What gets sent to the browser is:
> "<p>Hello World</p>"

Can you show us your view code (e.g. app.py) that produces that
output? Are you using render_template? Or just returning a string?

Re: [flask] Flask Quoting Everything on Returns from Requests

From:
Michael Johnston
Date:
2012-05-26 @ 14:38
It's amazing what a day away from some vexing code can do. I went back and
realized I was wrapping all responses as JSON, which would seem to account
for the extra quotes. 

So, I sheepishly say, sorry for the false alarm. 8-)


On Saturday, May 26, 2012 at 10:30 AM, Steven Kryskalla wrote: 
> On Sat, May 26, 2012 at 7:16 AM, Michael Johnston <mikej165@gmail.com 
(mailto:mikej165@gmail.com)> wrote:
> > What gets sent to the browser is:
> > "<p>Hello World</p>"
> > 
> 
> 
> Can you show us your view code (e.g. app.py) that produces that
> output? Are you using render_template? Or just returning a string?
> 
>