Hi,
The following code outputs the actual HTML text to the browser, not the
interpreted text.
Any idea ?
Regards,
Philippe
import cgi
import logging
import auth #this is the one you must implement (or use SCF ;-)
html_ok = """
Content-Type: text/html\n
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">\n
<html>\n
<head>\n
<title>Access Granted</title>\n
<meta name="GENERATOR " content="Quanta Plus">\n
<meta http-equiv="Content-Type" content="text/html; charset=koi8-r">\n
</head>\n
<body>\n
<H1>Access Granted</H1>\n
<HR>\n
<H4>Welcome %s </H4>\n
<HR>\n
</body>\n
</html>\n
"""
html_nok = """
"Content-Type: text/html\n\n"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Access Granted</title>
<meta name="GENERATOR " content="Quanta Plus">
<meta http-equiv="Content-Type" content="text/html; charset=koi8-r">
</head>
<body>
<H1>Access Denied</H1>
<HR>
</body>
</html>
"""
# DISPLAY ACCESS DENIED PAGE
def Failure():
print html_nok
#DISPLAY ACCESS GRANTED PAGE
def Success(p_data) :
print html_ok % (p_data) 5 1708
the title should say "python cgi script html output not understood as html"
Philippe C. Martin wrote: Hi,
The following code outputs the actual HTML text to the browser, not the interpreted text.
Any idea ?
Regards,
Philippe import cgi import logging import auth #this is the one you must implement (or use SCF ;-)
html_ok = """ Content-Type: text/html\n <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n <html>\n <head>\n <title>Access Granted</title>\n <meta name="GENERATOR " content="Quanta Plus">\n <meta http-equiv="Content-Type" content="text/html; charset=koi8-r">\n </head>\n <body>\n <H1>Access Granted</H1>\n <HR>\n <H4>Welcome %s </H4>\n <HR>\n </body>\n </html>\n """
html_nok = """ "Content-Type: text/html\n\n" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html>
<head> <title>Access Granted</title> <meta name="GENERATOR " content="Quanta Plus"> <meta http-equiv="Content-Type" content="text/html; charset=koi8-r"> </head> <body> <H1>Access Denied</H1> <HR>
</body> </html> """ # DISPLAY ACCESS DENIED PAGE def Failure(): print html_nok
#DISPLAY ACCESS GRANTED PAGE def Success(p_data) : print html_ok % (p_data)
Philippe C. Martin wrote: Hi,
The following code outputs the actual HTML text to the browser, not the interpreted text.
Any idea ?
html_ok = """ Content-Type: text/html\n <html> ... """
Avoid the starting newline (before content-type).
Add at least TWO newlines after content-type.
Or use a package to handle the HTTP stuff for you.
Philippe C. Martin wrote: The following code outputs the actual HTML text to the browser, not the interpreted text.
html_ok = """ Content-Type: text/html\n <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n
HTTP header lines must end with \r\n, not just with \n. Not sure this
is the solution to your specific problem though...
-Peter
Many thanks !!
Regards,
Philippe
Mitja Trampus wrote: Philippe C. Martin wrote: Hi,
The following code outputs the actual HTML text to the browser, not the interpreted text.
Any idea ?
html_ok = """ Content-Type: text/html\n > <html> > ... > """
Avoid the starting newline (before content-type). Add at least TWO newlines after content-type.
Or use a package to handle the HTTP stuff for you.
It is, thanks.
Philippe
Peter Hansen wrote: Philippe C. Martin wrote: The following code outputs the actual HTML text to the browser, not the interpreted text.
html_ok = """ Content-Type: text/html\n <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n
HTTP header lines must end with \r\n, not just with \n. Not sure this is the solution to your specific problem though...
-Peter This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ben moretti |
last post by:
hi
i'm learning python, and one area i'd use it for is data management in
scientific computing. in the case i've tried i want to reformat a data
file from a normalised list to a matrix with some sorted columns. to
do this at the moment i am using perl, which is very easy to do, and i
want to see if python is as easy.
so, the data i am using is some epiphyte population abundance data for
particular sites, and it looks like this:
|
by: TPJ |
last post by:
First I have to admit that my English isn't good enough. I'm still
studying and sometimes I just can't express what I want to express.
A few weeks ago I've written 'Python Builder' - a bash script that
allows anyone to download, compile (with flags given by user) and
install Python and some external modules (e.g. wxPython, PyGTK,
Numeric...). I use Python every day and when new version of Python (or
some external module) is released, I...
|
by: Iddo |
last post by:
Hi,
I am having a strange problem...
I have an HTML file which has 2 script tags:
1) <script language="javascript" id="ABC" src="ABC.js" />
2) <script id="general" language="javascript">
function foo()
{
alert("aaa");
}
</script>
|
by: Fabian Braennstroem |
last post by:
Hi,
I am looking for a small python script, which starts a small
web server with python cgi support on a linux machine.
I tried:
#!/usr/bin/env python
import sys
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |