[Flask] [EXT] Re: render_template_string doesn't render
Patrick L Jones
plj at mitre.org
Thu Aug 19 08:39:47 EDT 2021
Greetings,
Thank all of you who helped. I got it working as follows:
def get(self):
return Response('<h1>PLEASE CLOSE THIS WINDOW</h1>', 200, mimetype='text/html')
thanx again
Pat
-----Original Message-----
From: Flask <flask-bounces+plj=mitre.org at python.org> On Behalf Of Dennis Lee Bieber
Sent: Wednesday, August 18, 2021 2:55 PM
To: flask at python.org
Subject: Re: [Flask] [EXT] Re: render_template_string doesn't render
On Wed, 18 Aug 2021 17:36:39 +0000, Patrick L Jones <plj at mitre.org> declaimed the following:
>
> I'm using Chrome. I get the same result when I just return the string '<h1>PLEASE CLOSE THIS WINDOW</h1>' as using the render_template_string(). Chrome isn't recognizing it as html.
> As I said it the start of this thread my flask get() method is being called by an OAUTH2 redirect. Any idea how I would make Chrome understand that its getting back html instead of text?
>
I don't normally use Chrome, so I don't know what capabilities it provides (my closest exposure is the version on my cell-phone -- and that one seems to be optimized to push advertising at me over actual content, and doesn't support things like ad-block and no-script).
Does it allow you to display the raw page source? If it does, what does that page look like? {Hmmm, disgusting -- even the U-verse modem /status/ page is over 400 lines of HTML}
https://flask.palletsprojects.com/en/2.0.x/api/#response-objects
indicates that the HTML mimetype is the default, but possibly something in your environment is overriding that -- however, (making an assumption here) https://pythonhosted.org/Flask-OAuth/ seems to reverse the scheme some in that it /sends/ "requests" -- and those requests default to either "urlencoded" or "json"; if one is transferring something else, one needs to provide "content_type" argument.
>
>-----Original Message-----
>From: Flask <flask-bounces+plj=mitre.org at python.org> On Behalf Of
>Dennis Lee Bieber
Hmmm, apparently another moderated forum made available on gmane's NNTP gateway.
Apologies to the admins then -- I much favor my newsreader for such forums as it manages threads and short term history much cleaner than my mail client would (autopurging old messages, distributing to a group-specific "folder" rather than requiring me to create filters, and fetching messages on my schedule -- vs either piecemeal during the day in my mail client, or one bundle per day that then needs to be burst to be reasonably usable [which my mail client can not do; my news client has the ability, but I'd have to create a distinct email address to separate forum posts from my regular email addresses]).
At least the post did get accepted. I think the Firebird group I'm tracking is just round-filing any responses I make.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed at ix.netcom.com http://wlfraed.microdiversity.freeddns.org/
_______________________________________________
Flask mailing list
Flask at python.org
https://mail.python.org/mailman/listinfo/flask
More information about the Flask
mailing list