summaryrefslogtreecommitdiffstats
path: root/Tools/faqwiz/faqconf.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-05-26 05:43:29 (GMT)
committerGuido van Rossum <guido@python.org>1997-05-26 05:43:29 (GMT)
commitea31ea2859a005f8a794f715df925a1385bdc435 (patch)
tree16ce6cc781efa4e9e0d1ae9b42ce9463b6b3a928 /Tools/faqwiz/faqconf.py
parent1677e5b5ddea42814f3c933c22da0779fc538f81 (diff)
downloadcpython-ea31ea2859a005f8a794f715df925a1385bdc435.zip
cpython-ea31ea2859a005f8a794f715df925a1385bdc435.tar.gz
cpython-ea31ea2859a005f8a794f715df925a1385bdc435.tar.bz2
I'm happy with this.
Diffstat (limited to 'Tools/faqwiz/faqconf.py')
-rw-r--r--Tools/faqwiz/faqconf.py248
1 files changed, 178 insertions, 70 deletions
diff --git a/Tools/faqwiz/faqconf.py b/Tools/faqwiz/faqconf.py
index de82e22..2cd4b9e 100644
--- a/Tools/faqwiz/faqconf.py
+++ b/Tools/faqwiz/faqconf.py
@@ -1,36 +1,87 @@
-# Miscellaneous customization constants
-PASSWORD = "Spam" # Edit password. Change this!
-FAQCGI = 'faqw.py' # Relative URL of the FAQ cgi script
+"""FAQ Wizard customization module.
+
+Edit this file to customize the FAQ Wizard. For normal purposes, you
+should only have to change the FAQ section titles and the small group
+of parameters below it.
+
+"""
+
+# Titles of FAQ sections
+
+SECTION_TITLES = {
+ 1: "General information and availability",
+ 2: "Python in the real world",
+ 3: "Building Python and Other Known Bugs",
+ 4: "Programming in Python",
+ 5: "Extending Python",
+ 6: "Python's design",
+ 7: "Using Python on non-UNIX platforms",
+}
+
+# Parameters you definitely want to change
+
+PASSWORD = "Spam" # Editing password
FAQNAME = "Python FAQ" # Name of the FAQ
OWNERNAME = "GvR" # Name for feedback
OWNEREMAIL = "guido@python.org" # Email for feedback
HOMEURL = "http://www.python.org" # Related home page
HOMENAME = "Python home" # Name of related home page
-MAXHITS = 10 # Max #hits to be shown directly
COOKIE_NAME = "Python-FAQ-Wizard" # Name used for Netscape cookie
-COOKIE_LIFETIME = 4 *7 * 24 * 3600 # Cookie expiration in seconds
+RCSBINDIR = "/depot/gnu/plat/bin/" # Directory containing RCS commands
+ # (must end in a slash)
+
+# Parameters you can normally leave alone
+
+FAQCGI = 'faqw.py' # Relative URL of the FAQ cgi script
+MAXHITS = 10 # Max #hits to be shown directly
+COOKIE_LIFETIME = 28*24*3600 # Cookie expiration in seconds
+ # (28*24*3600 = 28 days = 4 weeks)
+
+# Regular expression to recognize FAQ entry files: group(1) should be
+# the section number, group(2) should be the question number. Both
+# should be fixed width so simple-minded sorting yields the right
+# order.
+
+OKFILENAME = "^faq\([0-9][0-9]\)\.\([0-9][0-9][0-9]\)\.htp$"
+
+# Format to construct a FAQ entry file name
+
+NEWFILENAME = "faq%02d.%03d.htp"
+
+# Version -- don't change unless you edit faqwiz.py
+
+WIZVERSION = "0.3 (alpha)" # FAQ Wizard version
+
+# ----------------------------------------------------------------------
+
+# Anything below this point normally needn't be changed; you would
+# change this if you were to create e.g. a French translation or if
+# you just aren't happy with the text generated by the FAQ Wizard.
+
+# Most strings here are subject to substitution (string%dictionary)
# RCS commands
-RCSBINDIR = "/depot/gnu/plat/bin/" # Directory containing RCS commands
+
SH_RLOG = RCSBINDIR + "rlog %(file)s </dev/null 2>&1"
SH_RLOG_H = RCSBINDIR + "rlog -h %(file)s </dev/null 2>&1"
SH_RDIFF = RCSBINDIR + "rcsdiff -r%(prev)s -r%(rev)s %(file)s </dev/null 2>&1"
SH_LOCK = RCSBINDIR + "rcs -l %(file)s </dev/null 2>&1"
SH_CHECKIN = RCSBINDIR + "ci -u %(file)s <%(tfn)s 2>&1"
-# Titles for various output pages
-T_HOME = FAQNAME + " Wizard 0.2 (alpha)"
+# Titles for various output pages (not subject to substitution)
+
+T_HOME = FAQNAME + " Wizard " + WIZVERSION
T_ERROR = "Sorry, an error occurred"
T_ROULETTE = FAQNAME + " Roulette"
T_ALL = "The Whole " + FAQNAME
T_INDEX = FAQNAME + " Index"
T_SEARCH = FAQNAME + " Search Results"
-T_RECENT = "Recently Changed %s Entries" % FAQNAME
+T_RECENT = "What's New in the " + FAQNAME
T_SHOW = FAQNAME + " Entry"
T_LOG = "RCS log for %s entry" % FAQNAME
T_DIFF = "RCS diff for %s entry" % FAQNAME
-T_ADD = "How to add an entry to the " + FAQNAME
-T_DELETE = "How to delete an entry from the " + FAQNAME
+T_ADD = "Add an entry to the " + FAQNAME
+T_DELETE = "Deleting an entry from the " + FAQNAME
T_EDIT = FAQNAME + " Edit Wizard"
T_REVIEW = T_EDIT + " - Review Changes"
T_COMMITTED = T_EDIT + " - Changes Committed"
@@ -38,17 +89,6 @@ T_COMMITFAILED = T_EDIT + " - Commit Failed"
T_CANTCOMMIT = T_EDIT + " - Commit Rejected"
T_HELP = T_EDIT + " - Help"
-# Titles of FAQ sections
-SECTION_TITLES = {
- 1: "General information and availability",
- 2: "Python in the real world",
- 3: "Building Python and Other Known Bugs",
- 4: "Programming in Python",
- 5: "Extending Python",
- 6: "Python's design",
- 7: "Using Python on non-UNIX platforms",
-}
-
# Generic prologue and epilogue
PROLOGUE = '''
@@ -68,7 +108,7 @@ PROLOGUE = '''
EPILOGUE = '''
<HR>
<A HREF="%(HOMEURL)s">%(HOMENAME)s</A> /
-<A HREF="%(FAQCGI)s?req=home">%(FAQNAME)s Wizard</A> /
+<A HREF="%(FAQCGI)s?req=home">%(FAQNAME)s Wizard %(WIZVERSION)s</A> /
Feedback to <A HREF="mailto:%(OWNEREMAIL)s">%(OWNERNAME)s</A>
</BODY>
@@ -78,18 +118,41 @@ Feedback to <A HREF="mailto:%(OWNEREMAIL)s">%(OWNERNAME)s</A>
# Home page
HOME = """
+<H2>Search the %(FAQNAME)s:</H2>
+
+<BLOCKQUOTE>
+
<FORM ACTION="%(FAQCGI)s">
<INPUT TYPE=text NAME=query>
<INPUT TYPE=submit VALUE="Search"><BR>
- (Case insensitive regular expressions.)
+ <INPUT TYPE=radio NAME=querytype VALUE=simple CHECKED>
+ Simple string
+ /
+ <INPUT TYPE=radio NAME=querytype VALUE=regex>
+ Regular expression
+ <BR>
+ <INPUT TYPE=radio NAME=casefold VALUE=yes CHECKED>
+ Fold case
+ /
+ <INPUT TYPE=radio NAME=casefold VALUE=no>
+ Case sensitive
+ <BR>
<INPUT TYPE=hidden NAME=req VALUE=search>
</FORM>
+</BLOCKQUOTE>
+
+<HR>
+
+<H2>Other forms of %(FAQNAME)s access:</H2>
+
<UL>
<LI><A HREF="%(FAQCGI)s?req=index">FAQ index</A>
<LI><A HREF="%(FAQCGI)s?req=all">The whole FAQ</A>
-<LI><A HREF="%(FAQCGI)s?req=recent">Recently changed FAQ entries</A>
+<LI><A HREF="%(FAQCGI)s?req=recent">What's new in the FAQ?</A>
<LI><A HREF="%(FAQCGI)s?req=roulette">FAQ roulette</A>
+<LI><A HREF="%(FAQCGI)s?req=add">Add a FAQ entry</A>
+<LI><A HREF="%(FAQCGI)s?req=delete">Delete a FAQ entry</A>
</UL>
"""
@@ -98,23 +161,34 @@ HOME = """
INDEX_SECTION = """
<P>
<HR>
-<H2>%(sec)d. %(title)s</H2>
+<H2>%(sec)s. %(title)s</H2>
<UL>
"""
+INDEX_ADDSECTION = """
+<P>
+<LI><A HREF="%(FAQCGI)s?req=new&amp;section=%(sec)s">Add new entry</A>
+(at this point)
+"""
+
INDEX_ENDSECTION = """
</UL>
"""
INDEX_ENTRY = """\
-<LI><A HREF="%(FAQCGI)s?req=show&file=%(file)s">%(title)s</A><BR>
+<LI><A HREF="%(FAQCGI)s?req=show&amp;file=%(file)s">%(title)s</A><BR>
"""
# Entry formatting
+ENTRY_HEADER = """
+<HR>
+<H2>%(title)s</H2>
+"""
+
ENTRY_FOOTER = """
-<A HREF="%(FAQCGI)s?req=edit&file=%(file)s">Edit this entry</A> /
-<A HREF="%(FAQCGI)s?req=log&file=%(file)s">Log info</A>
+<A HREF="%(FAQCGI)s?req=edit&amp;file=%(file)s">Edit this entry</A> /
+<A HREF="%(FAQCGI)s?req=log&amp;file=%(file)s">Log info</A>
"""
ENTRY_LOGINFO = """
@@ -133,12 +207,12 @@ Your search matched the following entry:
"""
FEW_HITS = """
-Your search matched the following %(count)d entries:
+Your search matched the following %(count)s entries:
"""
MANY_HITS = """
-Your search matched more than %(MAXHITS)d entries.
-The %(count)d matching entries are presented here ordered by section:
+Your search matched more than %(MAXHITS)s entries.
+The %(count)s matching entries are presented here ordered by section:
"""
# RCS log and diff
@@ -149,7 +223,7 @@ previous one.
"""
DIFFLINK = """\
-<A HREF="%(FAQCGI)s?req=diff&file=%(file)s&rev=%(rev)s">%(line)s</A>
+<A HREF="%(FAQCGI)s?req=diff&amp;file=%(file)s&amp;rev=%(rev)s">%(line)s</A>
"""
# Recently changed entries
@@ -159,52 +233,34 @@ NO_RECENT = """
No %(FAQNAME)s entries were changed in the last %(period)s.
"""
-ONE_RECENT = """
+VIEW_MENU = """
<HR>
-View entries changed in the last:
+View entries changed in the last...
<UL>
-<LI><A HREF="%(FAQCGI)s?req=recent&days=1">24 hours</A>
-<LI><A HREF="%(FAQCGI)s?req=recent&days=2">2 days</A>
-<LI><A HREF="%(FAQCGI)s?req=recent&days=3">3 days</A>
-<LI><A HREF="%(FAQCGI)s?req=recent&days=7">week</A>
-<LI><A HREF="%(FAQCGI)s?req=recent&days=28">4 weeks</A>
-<LI><A HREF="%(FAQCGI)s?req=recent&days=365250">millennium</A>
+<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=1">24 hours</A>
+<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=2">2 days</A>
+<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=3">3 days</A>
+<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=7">week</A>
+<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=28">4 weeks</A>
+<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=365250">millennium</A>
</UL>
+"""
+
+ONE_RECENT = VIEW_MENU + """
The following %(FAQNAME)s entry was changed in the last %(period)s:
"""
-SOME_RECENT = """
-<HR>
-View entries changed in the last:
-<UL>
-<LI><A HREF="%(FAQCGI)s?req=recent&days=1">24 hours</A>
-<LI><A HREF="%(FAQCGI)s?req=recent&days=2">2 days</A>
-<LI><A HREF="%(FAQCGI)s?req=recent&days=3">3 days</A>
-<LI><A HREF="%(FAQCGI)s?req=recent&days=7">week</A>
-<LI><A HREF="%(FAQCGI)s?req=recent&days=28">4 weeks</A>
-<LI><A HREF="%(FAQCGI)s?req=recent&days=365250">millennium</A>
-</UL>
-The following %(count)d %(FAQNAME)s entries were changed
+SOME_RECENT = VIEW_MENU + """
+The following %(count)s %(FAQNAME)s entries were changed
in the last %(period)s, most recently changed shown first:
"""
-TAIL_RECENT = """
-<HR>
-View entries changed in the last:
-<UL>
-<LI><A HREF="%(FAQCGI)s?req=recent&days=1">24 hours</A>
-<LI><A HREF="%(FAQCGI)s?req=recent&days=2">2 days</A>
-<LI><A HREF="%(FAQCGI)s?req=recent&days=3">3 days</A>
-<LI><A HREF="%(FAQCGI)s?req=recent&days=7">week</A>
-<LI><A HREF="%(FAQCGI)s?req=recent&days=28">4 weeks</A>
-<LI><A HREF="%(FAQCGI)s?req=recent&days=365250">millennium</A>
-</UL>
-"""
+TAIL_RECENT = VIEW_MENU
# Last changed banner on "all" (strftime format)
LAST_CHANGED = "Last changed on %c %Z"
-# "Compat" command prologue (no <BODY> tag)
+# "Compat" command prologue (this has no <BODY> tag)
COMPAT = """
<H1>The whole %(FAQNAME)s</H1>
"""
@@ -261,8 +317,8 @@ Click this button to commit your changes.
"""
NOCOMMIT = """
-You can't commit your changes unless you enter a log message, your
-name, email addres, and the correct password in the form below.
+To commit your changes, please enter a log message, your name, email
+addres, and the correct password in the form below.
<HR>
"""
@@ -280,6 +336,27 @@ Please use your browser's Back command to correct the form and commit
again.
"""
+NEWCONFLICT = """
+<P>
+You are creating a new entry, but the entry number specified is not
+correct.
+<P>
+The two most common causes of this problem are:
+<UL>
+<LI>After creating the entry yourself, you went back in your browser,
+ edited the entry some more, and clicked Commit again.
+<LI>Someone else started creating a new entry in the same section and
+ committed before you did.
+</UL>
+(It is also possible that the last entry in the section was physically
+deleted, but this should not happen except through manual intervention
+by the FAQ maintainer.)
+<P>
+<A HREF="%(FAQCGI)s?req=new&amp;section=%(sec)s">Click here to try
+again.</A>
+<P>
+"""
+
VERSIONCONFLICT = """
<P>
You edited version %(editversion)s but the current version is %(version)s.
@@ -292,8 +369,8 @@ The two most common causes of this problem are:
before you did.
</UL>
<P>
-<A HREF="%(FAQCGI)s?req=show&file=%(file)s">Click here to reload the entry
-and try again.</A>
+<A HREF="%(FAQCGI)s?req=show&amp;file=%(file)s">Click here to reload
+the entry and try again.</A>
<P>
"""
@@ -328,6 +405,37 @@ COMMITFAILED = """
Exit status %(sts)04x.
"""
+# Add/Delete
+
+ADD_HEAD = """
+At the moment, new entries can only be added at the end of a section.
+This is because the entry numbers are also their
+unique identifiers -- it's a bad idea to renumber entries.
+<P>
+Click on the section to which you want to add a new entry:
+<UL>
+"""
+
+ADD_SECTION = """\
+<LI><A HREF="%(FAQCGI)s?req=new&amp;section=%(section)s">%(section)s. %(title)s</A>
+"""
+
+ADD_TAIL = """
+</UL>
+"""
+
+DELETE = """
+At the moment, there's no direct way to delete entries.
+This is because the entry numbers are also their
+unique identifiers -- it's a bad idea to renumber entries.
+<P>
+If you really think an entry needs to be deleted,
+change the title to "(deleted)" and make the body
+empty (keep the entry number in the title though).
+"""
+
+# Help file for the FAQ Edit Wizard
+
HELP = """
Using the %(FAQNAME)s Edit Wizard speaks mostly for itself. Here are
some answers to questions you are likely to ask: