Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Trouble with CGI code from Code Example 7.3 of the "Python Interactive CGI Tutorial"

Reply
Thread Tools

Trouble with CGI code from Code Example 7.3 of the "Python Interactive CGI Tutorial"

 
 
epsilon
Guest
Posts: n/a
 
      08-21-2007
Hey gang!

I'm having trouble with this script from a CGI lesson I'm working and
I can't seem to figure it out. I was wondering if someone could tell
me what is wrong. I've spent several hours trying to debug, but no
success. Any help would be appreciated.

Thank you,
Christopher

+++++

Python Interactive CGI Tutorial - Code Example 7.3
http://www.cs.virginia.edu/~lab2q/lesson_7/

# Define function display_page.
def display_page(result, id, session_key = 0):
print "<HTML>\n"
print "<HEAD>\n"
print "\t<TITLE>Info Form</TITLE>\n"
print "</HEAD>\n"
print "<BODY BGCOLOR = white>\n"
if (result == "passed"):
if (session_key == 0):
session_key = create_session(id)
print id, , you are logged in with key:", session_key,
"\n"
print "\t\t<FORM METHOD = post ACTION = \
\"example_7.3.cgi\">\n"
print "\t\t<INPUT TYPE = \"hidden\" NAME = \
\"session_key\" VALUE =\", session_key, ">\n"
print "\t\t<INPUT TYPE = \"submit\" \
VALUE = \"Stay Logged In.\"></FORM>\n"
print "\t\t<FORM METHOD = post ACTION = \
\"example_7.3.cgi\">\n"
print "\t\t<INPUT TYPE = \"hidden\" NAME = \
\"session_key\" VALUE =", session_key, ">\n"
print "\t\t<INPUT TYPE = \"hidden\" NAME =\
\"logout\" VALUE = \"logout\" >\n"
print "\t\t<INPUT TYPE = \"submit\" \
VALUE = \"Logout.\"></FORM>\n"
else:
print "You entered the incorrect combo.\n"
print "</BODY>\n"
print "</HTML>\n"

 
Reply With Quote
 
 
 
 
Gabriel Genellina
Guest
Posts: n/a
 
      08-21-2007
On 21 ago, 11:14, epsilon <(E-Mail Removed)> wrote:

> I'm having trouble with this script from a CGI lesson I'm working and
> I can't seem to figure it out. I was wondering if someone could tell
> me what is wrong. I've spent several hours trying to debug, but no
> success. Any help would be appreciated.


Next time try to post the exact error message you get - working
crystall balls are hard to find nowadays
Ok, it's a syntax error, perhaps you didn't get a useful response from
the server.
The error is here:

> if (session_key == 0):
> session_key = create_session(id)
> print id, , you are logged in with key:", session_key,


That should read:

print id, "you are logged in with key:", session_key, "\n"

--
Gabriel Genellina

 
Reply With Quote
 
 
 
 
epsilon
Guest
Posts: n/a
 
      08-21-2007
Gabriel,

Thanks a bunch for your time! That took care of it.

Christopher


Gabriel Genellina wrote:
> On 21 ago, 11:14, epsilon <(E-Mail Removed)> wrote:
>
> > I'm having trouble with this script from a CGI lesson I'm working and
> > I can't seem to figure it out. I was wondering if someone could tell
> > me what is wrong. I've spent several hours trying to debug, but no
> > success. Any help would be appreciated.

>
> Next time try to post the exact error message you get - working
> crystall balls are hard to find nowadays
> Ok, it's a syntax error, perhaps you didn't get a useful response from
> the server.
> The error is here:
>
> > if (session_key == 0):
> > session_key = create_session(id)
> > print id, , you are logged in with key:", session_key,

>
> That should read:
>
> print id, "you are logged in with key:", session_key, "\n"
>
> --
> Gabriel Genellina


 
Reply With Quote
 
Steve Holden
Guest
Posts: n/a
 
      08-21-2007
Gabriel Genellina wrote:

[...]working crystall balls are hard to find nowadays

Well, judging by the OP's response you appear to be in possession of a
pair

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------

 
Reply With Quote
 
Gabriel Genellina
Guest
Posts: n/a
 
      08-22-2007
On 21 ago, 20:10, Steve Holden <(E-Mail Removed)> wrote:
> Gabriel Genellina wrote:
>
> [...]working crystall balls are hard to find nowadays
>
> Well, judging by the OP's response you appear to be in possession of a
> pair


Great-grandmother's legacy, and not for sale!

--
Gabriel Genellina

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CGI.pm not interactive at command line Peter_W_Levine@uhc.com Perl Misc 4 12-22-2005 05:22 PM
CGI.pm not interactive at command line Peter_W_Levine@uhc.com Perl Misc 1 12-21-2005 11:31 PM
Interactive/Non-interactive ASPX ? WJ ASP .Net 2 02-26-2005 02:54 AM
non Interactive and Interactive AAH Computer Support 0 01-09-2005 04:09 PM
Interactive and non interactive AAH Computer Support 1 01-09-2005 04:01 PM



Advertisments