Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #27240
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:: [': 0.03; 'debugging': 0.05; '%s"': 0.07; '-*-': 0.07; 'reason,': 0.07; 'utf-8': 0.07; 'scripts': 0.09; 'python': 0.09; 'coding:': 0.09; 'itself,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:Why': 0.09; 'underlying': 0.09; 'subject:not': 0.11; 'as- is': 0.16; 'gilles': 0.16; 'kern': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.17; 'subject:] ': 0.19; 'variable': 0.20; 'import': 0.21; 'displayed': 0.22; 'interpret': 0.22; 'script': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'plain': 0.27; 'skip:# 10': 0.27; 'displays': 0.27; 'instead.': 0.27; 'header:X-Complaints-To:1': 0.28; 'cgi': 0.29; "i'm": 0.29; 'skip:- 10': 0.32; 'could': 0.32; 'print': 0.32; 'to:addr:python-list': 0.33; 'text': 0.34; 'server': 0.35; 'robert': 0.35; 'pm,': 0.35; 'subject:?': 0.35; 'received:org': 0.36; 'but': 0.36; 'test': 0.36; 'available.': 0.37; 'being': 0.37; 'some': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'google': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'enable': 0.60; 'different': 0.63; 'world': 0.63; 'our': 0.65; 'treat': 0.65; 'due': 0.66; 'believe': 0.69; 'eco': 0.84; 'terrible': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Robert Kern <robert.kern@gmail.com> |
| Subject | Re: [CGI] Why is HTML not rendered? |
| Date | Fri, 17 Aug 2012 14:44:37 +0100 |
| References | <hihs289062ottjtqpgpkbl3pb6b1irj9kq@4ax.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | 213.1.240.227 |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20120713 Thunderbird/14.0 |
| In-Reply-To | <hihs289062ottjtqpgpkbl3pb6b1irj9kq@4ax.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3415.1345211095.4697.python-list@python.org> (permalink) |
| Lines | 51 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1345211095 news.xs4all.nl 6978 [2001:888:2000:d::a6]:54844 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:27240 |
Show key headers only | View raw
On 8/17/12 2:27 PM, Gilles wrote:
> Hello
>
> I'm learning how to call Python scripts through the different
> solutions available.
>
> For some reason, this CGI script that I found on Google displays the
> contents of the variable but the HTML surrounding it is displayed
> as-is by the browser instead of being rendered:
>
> --------------
> #!/usr/bin/env python
> # -*- coding: UTF-8 -*-
>
> # enable debugging
> import cgitb
> cgitb.enable()
>
> import cgi
> form = cgi.FieldStorage()
>
> # get a value from the form
> value = form.getvalue("dummy")
>
> print "Content-Type: text/plain;charset=utf-8"
> print
>
> # print a document
> print "<P>You typed: <TT>%s</TT></P>" % (
> cgi.escape(value),
> )
> --------------
>
> Here's the output:
> --------------
> <P>You typed: <TT>test</TT></P>
> --------------
>
> Could this be due to the script itself, or some server configuration?
By using "Content-Type: text/plain", you told the browser to treat it like plain
text instead of HTML. Use text/html instead.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[CGI] Why is HTML not rendered? Gilles <nospam@nospam.com> - 2012-08-17 15:27 +0200
Re: [CGI] Why is HTML not rendered? Dan Sommers <dan@tombstonezero.net> - 2012-08-17 06:41 -0700
Re: [CGI] Why is HTML not rendered? Robert Kern <robert.kern@gmail.com> - 2012-08-17 14:44 +0100
Re: [CGI] Why is HTML not rendered? Gilles <nospam@nospam.com> - 2012-08-17 18:19 +0200
Re: [CGI] Why is HTML not rendered? Alexander Blinne <news@blinne.net> - 2012-08-17 15:40 +0200
csiph-web