blob: 3af5b5e243948a357b98796fd657f2fe0a3def1b [file] [log] [blame]
Guido van Rossumea31ea21997-05-26 05:43:29 +00001"""FAQ Wizard customization module.
Guido van Rossum1677e5b1997-05-26 00:07:18 +00002
Guido van Rossumea31ea21997-05-26 05:43:29 +00003Edit this file to customize the FAQ Wizard. For normal purposes, you
4should only have to change the FAQ section titles and the small group
5of parameters below it.
Guido van Rossum1677e5b1997-05-26 00:07:18 +00006
Guido van Rossumea31ea21997-05-26 05:43:29 +00007"""
Guido van Rossum1677e5b1997-05-26 00:07:18 +00008
9# Titles of FAQ sections
Guido van Rossumea31ea21997-05-26 05:43:29 +000010
Guido van Rossum1677e5b1997-05-26 00:07:18 +000011SECTION_TITLES = {
Guido van Rossum23052311997-05-26 06:12:50 +000012 # SectionNumber : SectionTitle; need at least one entry
Guido van Rossum1677e5b1997-05-26 00:07:18 +000013 1: "General information and availability",
Guido van Rossum1677e5b1997-05-26 00:07:18 +000014}
15
Guido van Rossumea31ea21997-05-26 05:43:29 +000016# Parameters you definitely want to change
17
Guido van Rossum23052311997-05-26 06:12:50 +000018SHORTNAME = "Generic" # FAQ name with "FAQ" omitted
19PASSWORD = "" # Password for editing
Guido van Rossumea31ea21997-05-26 05:43:29 +000020OWNERNAME = "GvR" # Name for feedback
21OWNEREMAIL = "guido@python.org" # Email for feedback
22HOMEURL = "http://www.python.org" # Related home page
23HOMENAME = "Python home" # Name of related home page
Guido van Rossumea31ea21997-05-26 05:43:29 +000024RCSBINDIR = "/depot/gnu/plat/bin/" # Directory containing RCS commands
25 # (must end in a slash)
26
27# Parameters you can normally leave alone
28
Guido van Rossumea31ea21997-05-26 05:43:29 +000029MAXHITS = 10 # Max #hits to be shown directly
30COOKIE_LIFETIME = 28*24*3600 # Cookie expiration in seconds
31 # (28*24*3600 = 28 days = 4 weeks)
32
Guido van Rossum23052311997-05-26 06:12:50 +000033# This parameter is normally overwritten with a dynamic value
34
35FAQCGI = 'faqw.py' # Relative URL of the FAQ cgi script
36import os, sys
37FAQCGI = os.path.basename(sys.argv[0]) or FAQCGI
38del os, sys
39
40# Load local customizations on top of the previous parameters
41
42try:
43 from faqcust import *
44except ImporError:
45 pass
46
47# Calculated parameter names
48
49COOKIE_NAME = SHORTNAME + "-FAQ-Wizard" # Name used for Netscape cookie
50FAQNAME = SHORTNAME + " FAQ" # Name of the FAQ
51
Guido van Rossumea31ea21997-05-26 05:43:29 +000052# Regular expression to recognize FAQ entry files: group(1) should be
53# the section number, group(2) should be the question number. Both
54# should be fixed width so simple-minded sorting yields the right
55# order.
56
57OKFILENAME = "^faq\([0-9][0-9]\)\.\([0-9][0-9][0-9]\)\.htp$"
58
59# Format to construct a FAQ entry file name
60
61NEWFILENAME = "faq%02d.%03d.htp"
62
63# Version -- don't change unless you edit faqwiz.py
64
65WIZVERSION = "0.3 (alpha)" # FAQ Wizard version
66
67# ----------------------------------------------------------------------
68
69# Anything below this point normally needn't be changed; you would
70# change this if you were to create e.g. a French translation or if
71# you just aren't happy with the text generated by the FAQ Wizard.
72
73# Most strings here are subject to substitution (string%dictionary)
74
75# RCS commands
76
77SH_RLOG = RCSBINDIR + "rlog %(file)s </dev/null 2>&1"
78SH_RLOG_H = RCSBINDIR + "rlog -h %(file)s </dev/null 2>&1"
79SH_RDIFF = RCSBINDIR + "rcsdiff -r%(prev)s -r%(rev)s %(file)s </dev/null 2>&1"
80SH_LOCK = RCSBINDIR + "rcs -l %(file)s </dev/null 2>&1"
81SH_CHECKIN = RCSBINDIR + "ci -u %(file)s <%(tfn)s 2>&1"
82
83# Titles for various output pages (not subject to substitution)
84
85T_HOME = FAQNAME + " Wizard " + WIZVERSION
86T_ERROR = "Sorry, an error occurred"
87T_ROULETTE = FAQNAME + " Roulette"
88T_ALL = "The Whole " + FAQNAME
89T_INDEX = FAQNAME + " Index"
90T_SEARCH = FAQNAME + " Search Results"
91T_RECENT = "What's New in the " + FAQNAME
92T_SHOW = FAQNAME + " Entry"
93T_LOG = "RCS log for %s entry" % FAQNAME
94T_DIFF = "RCS diff for %s entry" % FAQNAME
95T_ADD = "Add an entry to the " + FAQNAME
96T_DELETE = "Deleting an entry from the " + FAQNAME
97T_EDIT = FAQNAME + " Edit Wizard"
98T_REVIEW = T_EDIT + " - Review Changes"
99T_COMMITTED = T_EDIT + " - Changes Committed"
100T_COMMITFAILED = T_EDIT + " - Commit Failed"
101T_CANTCOMMIT = T_EDIT + " - Commit Rejected"
102T_HELP = T_EDIT + " - Help"
103
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000104# Generic prologue and epilogue
105
106PROLOGUE = '''
107<HTML>
108<HEAD>
109<TITLE>%(title)s</TITLE>
110</HEAD>
111
112<BODY BACKGROUND="http://www.python.org/pics/RedShort.gif"
113 BGCOLOR="#FFFFFF"
114 TEXT="#000000"
115 LINK="#AA0000"
116 VLINK="#906A6A">
117<H1>%(title)s</H1>
118'''
119
120EPILOGUE = '''
121<HR>
122<A HREF="%(HOMEURL)s">%(HOMENAME)s</A> /
Guido van Rossumea31ea21997-05-26 05:43:29 +0000123<A HREF="%(FAQCGI)s?req=home">%(FAQNAME)s Wizard %(WIZVERSION)s</A> /
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000124Feedback to <A HREF="mailto:%(OWNEREMAIL)s">%(OWNERNAME)s</A>
125
126</BODY>
127</HTML>
128'''
129
130# Home page
131
132HOME = """
Guido van Rossumea31ea21997-05-26 05:43:29 +0000133<H2>Search the %(FAQNAME)s:</H2>
134
135<BLOCKQUOTE>
136
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000137<FORM ACTION="%(FAQCGI)s">
138 <INPUT TYPE=text NAME=query>
139 <INPUT TYPE=submit VALUE="Search"><BR>
Guido van Rossumea31ea21997-05-26 05:43:29 +0000140 <INPUT TYPE=radio NAME=querytype VALUE=simple CHECKED>
141 Simple string
142 /
143 <INPUT TYPE=radio NAME=querytype VALUE=regex>
144 Regular expression
145 <BR>
146 <INPUT TYPE=radio NAME=casefold VALUE=yes CHECKED>
147 Fold case
148 /
149 <INPUT TYPE=radio NAME=casefold VALUE=no>
150 Case sensitive
151 <BR>
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000152 <INPUT TYPE=hidden NAME=req VALUE=search>
153</FORM>
154
Guido van Rossumea31ea21997-05-26 05:43:29 +0000155</BLOCKQUOTE>
156
157<HR>
158
159<H2>Other forms of %(FAQNAME)s access:</H2>
160
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000161<UL>
162<LI><A HREF="%(FAQCGI)s?req=index">FAQ index</A>
163<LI><A HREF="%(FAQCGI)s?req=all">The whole FAQ</A>
Guido van Rossumea31ea21997-05-26 05:43:29 +0000164<LI><A HREF="%(FAQCGI)s?req=recent">What's new in the FAQ?</A>
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000165<LI><A HREF="%(FAQCGI)s?req=roulette">FAQ roulette</A>
Guido van Rossumea31ea21997-05-26 05:43:29 +0000166<LI><A HREF="%(FAQCGI)s?req=add">Add a FAQ entry</A>
167<LI><A HREF="%(FAQCGI)s?req=delete">Delete a FAQ entry</A>
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000168</UL>
169"""
170
171# Index formatting
172
173INDEX_SECTION = """
174<P>
175<HR>
Guido van Rossumea31ea21997-05-26 05:43:29 +0000176<H2>%(sec)s. %(title)s</H2>
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000177<UL>
178"""
179
Guido van Rossumea31ea21997-05-26 05:43:29 +0000180INDEX_ADDSECTION = """
181<P>
182<LI><A HREF="%(FAQCGI)s?req=new&amp;section=%(sec)s">Add new entry</A>
183(at this point)
184"""
185
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000186INDEX_ENDSECTION = """
187</UL>
188"""
189
190INDEX_ENTRY = """\
Guido van Rossumea31ea21997-05-26 05:43:29 +0000191<LI><A HREF="%(FAQCGI)s?req=show&amp;file=%(file)s">%(title)s</A><BR>
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000192"""
193
194# Entry formatting
195
Guido van Rossumea31ea21997-05-26 05:43:29 +0000196ENTRY_HEADER = """
197<HR>
198<H2>%(title)s</H2>
199"""
200
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000201ENTRY_FOOTER = """
Guido van Rossumea31ea21997-05-26 05:43:29 +0000202<A HREF="%(FAQCGI)s?req=edit&amp;file=%(file)s">Edit this entry</A> /
203<A HREF="%(FAQCGI)s?req=log&amp;file=%(file)s">Log info</A>
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000204"""
205
206ENTRY_LOGINFO = """
207/ Last changed on %(last_changed_date)s by
208<A HREF="mailto:%(last_changed_email)s">%(last_changed_author)s</A>
209"""
210
211# Search
212
213NO_HITS = """
214No hits.
215"""
216
217ONE_HIT = """
218Your search matched the following entry:
219"""
220
221FEW_HITS = """
Guido van Rossumea31ea21997-05-26 05:43:29 +0000222Your search matched the following %(count)s entries:
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000223"""
224
225MANY_HITS = """
Guido van Rossumea31ea21997-05-26 05:43:29 +0000226Your search matched more than %(MAXHITS)s entries.
227The %(count)s matching entries are presented here ordered by section:
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000228"""
229
230# RCS log and diff
231
232LOG = """
233Click on a revision line to see the diff between that revision and the
234previous one.
235"""
236
237DIFFLINK = """\
Guido van Rossumea31ea21997-05-26 05:43:29 +0000238<A HREF="%(FAQCGI)s?req=diff&amp;file=%(file)s&amp;rev=%(rev)s">%(line)s</A>
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000239"""
240
241# Recently changed entries
242
243NO_RECENT = """
244<HR>
245No %(FAQNAME)s entries were changed in the last %(period)s.
246"""
247
Guido van Rossumea31ea21997-05-26 05:43:29 +0000248VIEW_MENU = """
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000249<HR>
Guido van Rossumea31ea21997-05-26 05:43:29 +0000250View entries changed in the last...
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000251<UL>
Guido van Rossumea31ea21997-05-26 05:43:29 +0000252<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=1">24 hours</A>
253<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=2">2 days</A>
254<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=3">3 days</A>
255<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=7">week</A>
256<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=28">4 weeks</A>
257<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=365250">millennium</A>
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000258</UL>
Guido van Rossumea31ea21997-05-26 05:43:29 +0000259"""
260
261ONE_RECENT = VIEW_MENU + """
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000262The following %(FAQNAME)s entry was changed in the last %(period)s:
263"""
264
Guido van Rossumea31ea21997-05-26 05:43:29 +0000265SOME_RECENT = VIEW_MENU + """
266The following %(count)s %(FAQNAME)s entries were changed
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000267in the last %(period)s, most recently changed shown first:
268"""
269
Guido van Rossumea31ea21997-05-26 05:43:29 +0000270TAIL_RECENT = VIEW_MENU
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000271
272# Last changed banner on "all" (strftime format)
273LAST_CHANGED = "Last changed on %c %Z"
274
Guido van Rossumea31ea21997-05-26 05:43:29 +0000275# "Compat" command prologue (this has no <BODY> tag)
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000276COMPAT = """
277<H1>The whole %(FAQNAME)s</H1>
278"""
279
280# Editing
281
282EDITHEAD = """
283<A HREF="%(FAQCGI)s?req=help">Click for Help</A>
284"""
285
286REVIEWHEAD = EDITHEAD
287
288
289EDITFORM1 = """
290<FORM ACTION="%(FAQCGI)s" METHOD=POST>
291<INPUT TYPE=hidden NAME=req VALUE=review>
292<INPUT TYPE=hidden NAME=file VALUE=%(file)s>
293<INPUT TYPE=hidden NAME=editversion VALUE=%(editversion)s>
294<HR>
295"""
296
297EDITFORM2 = """
298Title: <INPUT TYPE=text SIZE=70 NAME=title VALUE="%(title)s"><BR>
299<TEXTAREA COLS=72 ROWS=20 NAME=body>%(body)s
300</TEXTAREA><BR>
301Log message (reason for the change):<BR>
302<TEXTAREA COLS=72 ROWS=5 NAME=log>%(log)s
303</TEXTAREA><BR>
304Please provide the following information for logging purposes:
305<TABLE FRAME=none COLS=2>
306 <TR>
307 <TD>Name:
308 <TD><INPUT TYPE=text SIZE=40 NAME=author VALUE="%(author)s">
309 <TR>
310 <TD>Email:
311 <TD><INPUT TYPE=text SIZE=40 NAME=email VALUE="%(email)s">
312 <TR>
313 <TD>Password:
314 <TD><INPUT TYPE=password SIZE=20 NAME=password VALUE="%(password)s">
315</TABLE>
316
317<INPUT TYPE=submit NAME=review VALUE="Preview Edit">
318Click this button to preview your changes.
319"""
320
321EDITFORM3 = """
322</FORM>
323"""
324
325COMMIT = """
326<INPUT TYPE=submit NAME=commit VALUE="Commit">
327Click this button to commit your changes.
328<HR>
329"""
330
331NOCOMMIT = """
Guido van Rossumea31ea21997-05-26 05:43:29 +0000332To commit your changes, please enter a log message, your name, email
333addres, and the correct password in the form below.
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000334<HR>
335"""
336
337CANTCOMMIT_HEAD = """
338Some required information is missing:
339<UL>
340"""
341NEED_PASSWD = "<LI>You must provide the correct passwd.\n"
342NEED_AUTHOR = "<LI>You must enter your name.\n"
343NEED_EMAIL = "<LI>You must enter your email address.\n"
344NEED_LOG = "<LI>You must enter a log message.\n"
345CANTCOMMIT_TAIL = """
346</UL>
347Please use your browser's Back command to correct the form and commit
348again.
349"""
350
Guido van Rossumea31ea21997-05-26 05:43:29 +0000351NEWCONFLICT = """
352<P>
353You are creating a new entry, but the entry number specified is not
354correct.
355<P>
356The two most common causes of this problem are:
357<UL>
358<LI>After creating the entry yourself, you went back in your browser,
359 edited the entry some more, and clicked Commit again.
360<LI>Someone else started creating a new entry in the same section and
361 committed before you did.
362</UL>
363(It is also possible that the last entry in the section was physically
364deleted, but this should not happen except through manual intervention
365by the FAQ maintainer.)
366<P>
367<A HREF="%(FAQCGI)s?req=new&amp;section=%(sec)s">Click here to try
368again.</A>
369<P>
370"""
371
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000372VERSIONCONFLICT = """
373<P>
374You edited version %(editversion)s but the current version is %(version)s.
375<P>
376The two most common causes of this problem are:
377<UL>
378<LI>After committing a change, you went back in your browser,
379 edited the entry some more, and clicked Commit again.
380<LI>Someone else started editing the same entry and committed
381 before you did.
382</UL>
383<P>
Guido van Rossumea31ea21997-05-26 05:43:29 +0000384<A HREF="%(FAQCGI)s?req=show&amp;file=%(file)s">Click here to reload
385the entry and try again.</A>
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000386<P>
387"""
388
389CANTWRITE = """
390Can't write file %(file)s (%(why)s).
391"""
392
393FILEHEADER = """\
394Title: %(title)s
395Last-Changed-Date: %(date)s
396Last-Changed-Author: %(author)s
397Last-Changed-Email: %(email)s
398Last-Changed-Remote-Host: %(REMOTE_HOST)s
399Last-Changed-Remote-Address: %(REMOTE_ADDR)s
400"""
401
402LOGHEADER = """\
403Last-Changed-Date: %(date)s
404Last-Changed-Author: %(author)s
405Last-Changed-Email: %(email)s
406Last-Changed-Remote-Host: %(REMOTE_HOST)s
407Last-Changed-Remote-Address: %(REMOTE_ADDR)s
408
409%(log)s
410"""
411
412COMMITTED = """
413Your changes have been committed.
414"""
415
416COMMITFAILED = """
417Exit status %(sts)04x.
418"""
419
Guido van Rossumea31ea21997-05-26 05:43:29 +0000420# Add/Delete
421
422ADD_HEAD = """
423At the moment, new entries can only be added at the end of a section.
424This is because the entry numbers are also their
425unique identifiers -- it's a bad idea to renumber entries.
426<P>
427Click on the section to which you want to add a new entry:
428<UL>
429"""
430
431ADD_SECTION = """\
432<LI><A HREF="%(FAQCGI)s?req=new&amp;section=%(section)s">%(section)s. %(title)s</A>
433"""
434
435ADD_TAIL = """
436</UL>
437"""
438
439DELETE = """
440At the moment, there's no direct way to delete entries.
441This is because the entry numbers are also their
442unique identifiers -- it's a bad idea to renumber entries.
443<P>
444If you really think an entry needs to be deleted,
445change the title to "(deleted)" and make the body
446empty (keep the entry number in the title though).
447"""
448
449# Help file for the FAQ Edit Wizard
450
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000451HELP = """
452Using the %(FAQNAME)s Edit Wizard speaks mostly for itself. Here are
453some answers to questions you are likely to ask:
454
455<P><HR>
456
457<H2>I can review an entry but I can't commit it.</H2>
458
459The commit button only appears if the following conditions are met:
460
461<UL>
462
463<LI>The Name field is not empty.
464
465<LI>The Email field contains at least an @ character.
466
467<LI>The Log message box is not empty.
468
469<LI>The Password field contains the proper password.
470
471</UL>
472
473<P><HR>
474
475<H2>What is the password?</H2>
476
477At the moment, only PSA members will be told the password. This is a
478good time to join the PSA! See <A
479HREF="http://www.python.org/psa/">the PSA home page</A>.
480
481<P><HR>
482
483<H2>Can I use HTML in the FAQ entry?</H2>
484
485No, but if you include a URL or an email address in the text it will
486automatigally become an anchor of the right type. Also, *word*
487is made italic (but only for single alphabetic words).
488
489<P><HR>
490
491<H2>How do I delineate paragraphs?</H2>
492
493Use blank lines to separate paragraphs.
494
495<P><HR>
496
497<H2>How do I enter example text?</H2>
498
499Any line that begins with a space or tab is assumed to be part of
500literal text. Blocks of literal text delineated by blank lines are
501placed inside &lt;PRE&gt;...&lt;/PRE&gt;.
502"""