Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9c6ceda

Browse files
committed
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.
1 parent a78a3c3 commit 9c6ceda

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

Tools/faqwiz/faqmain.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def __getattr__(self, key):
9696
return value
9797

9898
def do_frontpage(self):
99-
self.prologue("Python FAQ (beta test) Front Page")
99+
self.prologue("Python FAQ Wizard (beta test)")
100100
print """
101101
<UL>
102102
<LI><A HREF="faq.py?req=index">FAQ index</A>
@@ -574,7 +574,7 @@ def checkin(self):
574574
print "<PRE>%s</PRE>" % cgi.escape(output)
575575

576576
def set_cookie(self, author, email, password):
577-
name = "Python-FAQ-ID"
577+
name = "Python-FAQ-Wizard"
578578
value = "%s/%s/%s" % (author, email, password)
579579
import urllib
580580
value = urllib.quote(value)
@@ -587,18 +587,19 @@ def set_cookie(self, author, email, password):
587587

588588
def get_cookie(self):
589589
if not os.environ.has_key('HTTP_COOKIE'):
590-
return "", ""
590+
return "", "", ""
591591
raw = os.environ['HTTP_COOKIE']
592-
words = string.split(raw, ';')
592+
words = map(string.strip, string.split(raw, ';'))
593593
cookies = {}
594594
for word in words:
595595
i = string.find(word, '=')
596596
if i >= 0:
597597
key, value = word[:i], word[i+1:]
598598
cookies[key] = value
599-
if not cookies.has_key('Python-FAQ-ID'):
599+
print "\n<PRE>Cookies:", cookies, "</PRE>"
600+
if not cookies.has_key('Python-FAQ-Wizard'):
600601
return "", "", ""
601-
value = cookies['Python-FAQ-ID']
602+
value = cookies['Python-FAQ-Wizard']
602603
import urllib
603604
value = urllib.unquote(value)
604605
words = string.split(value, '/')
@@ -613,7 +614,7 @@ def showedit(self, name, title, text):
613614
author = self.author
614615
email = self.email
615616
password = self.password
616-
if not author or not email:
617+
if not author or not email or not password:
617618
a, e, p = self.get_cookie()
618619
author = author or a
619620
email = email or e

0 commit comments

Comments
 (0)