[Tutor] Having trouble with a form mail script.

Danny Yoo dyoo@uclink4.berkeley.edu
Fri, 30 Jun 2000 12:27:38 -0700 (PDT)


> What I want to do is put a meta refresh but when I ad that Line I get an
> Internal server error.

The line that's causing grief is most likely this one:

>     print "<meta http-equiv="refresh" content="3;URL=http://k86tech">"

It's the quotation.  Python's breaking it up into something like this:
  "<meta http-equiv=",
  refresh,
  " content="
  3;URL=http://k86tech
  ">"

which confuses the heck out of Python, since it doesn't realize when a '"'
should be treated as string termination, or as a literal '"'.  Since you
want to do quoting inside strings, the easiest solution to this is to use
single quotes to surround the html:

  print '<meta http-equiv="refresh" content="3;URL=http://k86tech">'

which will be recognized as a single string and is unambiguous.

Another way to do this would be to "protect" the inner quotes by escaping
them with backslashes.  "\"" is a string with a single quote, for example.