diff options
author | Guido van Rossum <guido@python.org> | 1997-05-23 22:44:01 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-05-23 22:44:01 (GMT) |
commit | 9c6cedaa08da1d1519a00c51311bec9bb457a425 (patch) | |
tree | 047304f1d3d47e763e0df5edd4f87331f41ceca1 /Tools/faqwiz/faqmain.py | |
parent | a78a3c30dd88fe76dd1554b69e60438fd63ed9cd (diff) | |
download | cpython-9c6cedaa08da1d1519a00c51311bec9bb457a425.zip cpython-9c6cedaa08da1d1519a00c51311bec9bb457a425.tar.gz cpython-9c6cedaa08da1d1519a00c51311bec9bb457a425.tar.bz2 |
The official name of the whole thing is now "Python FAQ Wizard";
and it's in beta testing now.
Renamed the cookie id to Python-FAQ-Wizard and fixed some bugs
related to cookie processing.
Diffstat (limited to 'Tools/faqwiz/faqmain.py')
-rw-r--r-- | Tools/faqwiz/faqmain.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Tools/faqwiz/faqmain.py b/Tools/faqwiz/faqmain.py index 96c9dbc..fcb82e9 100644 --- a/Tools/faqwiz/faqmain.py +++ b/Tools/faqwiz/faqmain.py @@ -96,7 +96,7 @@ class FAQServer: return value def do_frontpage(self): - self.prologue("Python FAQ (beta test) Front Page") + self.prologue("Python FAQ Wizard (beta test)") print """ <UL> <LI><A HREF="faq.py?req=index">FAQ index</A> @@ -574,7 +574,7 @@ class FAQServer: print "<PRE>%s</PRE>" % cgi.escape(output) def set_cookie(self, author, email, password): - name = "Python-FAQ-ID" + name = "Python-FAQ-Wizard" value = "%s/%s/%s" % (author, email, password) import urllib value = urllib.quote(value) @@ -587,18 +587,19 @@ class FAQServer: def get_cookie(self): if not os.environ.has_key('HTTP_COOKIE'): - return "", "" + return "", "", "" raw = os.environ['HTTP_COOKIE'] - words = string.split(raw, ';') + words = map(string.strip, string.split(raw, ';')) cookies = {} for word in words: i = string.find(word, '=') if i >= 0: key, value = word[:i], word[i+1:] cookies[key] = value - if not cookies.has_key('Python-FAQ-ID'): + print "\n<PRE>Cookies:", cookies, "</PRE>" + if not cookies.has_key('Python-FAQ-Wizard'): return "", "", "" - value = cookies['Python-FAQ-ID'] + value = cookies['Python-FAQ-Wizard'] import urllib value = urllib.unquote(value) words = string.split(value, '/') @@ -613,7 +614,7 @@ class FAQServer: author = self.author email = self.email password = self.password - if not author or not email: + if not author or not email or not password: a, e, p = self.get_cookie() author = author or a email = email or e |