blob: e353404e868880a90eb001697349874b0f0b8ae2 [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 Rossumfd67f731997-05-26 19:46:18 +000033# Markers appended to title to indicate recently change
34# (may contain HTML, e.g. <IMG>); and corresponding
35
36MARK_VERY_RECENT = " **" # Changed very recently
37MARK_RECENT = " *" # Changed recently
38DT_VERY_RECENT = 24*3600 # 24 hours
39DT_RECENT = 7*24*3600 # 7 days
40
41EXPLAIN_MARKS = """
42<P>
43(Entries marked with ** were changed within the last 24 hours;
44entries marked with * were changed within the last 7 days.)
45<P>
46"""
47
48# Version -- don't change unless you edit faqwiz.py
49
50WIZVERSION = "0.3 (alpha)" # FAQ Wizard version
51
Guido van Rossum23052311997-05-26 06:12:50 +000052# This parameter is normally overwritten with a dynamic value
53
54FAQCGI = 'faqw.py' # Relative URL of the FAQ cgi script
55import os, sys
56FAQCGI = os.path.basename(sys.argv[0]) or FAQCGI
57del os, sys
58
Guido van Rossumfd67f731997-05-26 19:46:18 +000059# Regular expression to recognize FAQ entry files: group(1) should be
60# the section number, group(2) should be the question number. Both
61# should be fixed width so simple-minded sorting yields the right
62# order.
63
64OKFILENAME = "^faq\([0-9][0-9]\)\.\([0-9][0-9][0-9]\)\.htp$"
65
66# Format to construct a FAQ entry file name
67
68NEWFILENAME = "faq%02d.%03d.htp"
69
Guido van Rossum23052311997-05-26 06:12:50 +000070# Load local customizations on top of the previous parameters
71
72try:
73 from faqcust import *
74except ImporError:
75 pass
76
77# Calculated parameter names
78
79COOKIE_NAME = SHORTNAME + "-FAQ-Wizard" # Name used for Netscape cookie
80FAQNAME = SHORTNAME + " FAQ" # Name of the FAQ
81
Guido van Rossumfd67f731997-05-26 19:46:18 +000082# Load local customizations again, in case they set COOKIE_NAME or FAQNAME
Guido van Rossumea31ea21997-05-26 05:43:29 +000083
Guido van Rossumfd67f731997-05-26 19:46:18 +000084try:
85 from faqcust import *
86except ImporError:
87 pass
Guido van Rossumea31ea21997-05-26 05:43:29 +000088
89# ----------------------------------------------------------------------
90
91# Anything below this point normally needn't be changed; you would
92# change this if you were to create e.g. a French translation or if
93# you just aren't happy with the text generated by the FAQ Wizard.
94
95# Most strings here are subject to substitution (string%dictionary)
96
97# RCS commands
98
99SH_RLOG = RCSBINDIR + "rlog %(file)s </dev/null 2>&1"
100SH_RLOG_H = RCSBINDIR + "rlog -h %(file)s </dev/null 2>&1"
101SH_RDIFF = RCSBINDIR + "rcsdiff -r%(prev)s -r%(rev)s %(file)s </dev/null 2>&1"
Guido van Rossum8bc49c81997-05-26 19:10:37 +0000102SH_REVISION = RCSBINDIR + "co -p%(rev)s %(file)s </dev/null 2>&1"
Guido van Rossumea31ea21997-05-26 05:43:29 +0000103SH_LOCK = RCSBINDIR + "rcs -l %(file)s </dev/null 2>&1"
104SH_CHECKIN = RCSBINDIR + "ci -u %(file)s <%(tfn)s 2>&1"
105
106# Titles for various output pages (not subject to substitution)
107
108T_HOME = FAQNAME + " Wizard " + WIZVERSION
109T_ERROR = "Sorry, an error occurred"
110T_ROULETTE = FAQNAME + " Roulette"
111T_ALL = "The Whole " + FAQNAME
112T_INDEX = FAQNAME + " Index"
113T_SEARCH = FAQNAME + " Search Results"
114T_RECENT = "What's New in the " + FAQNAME
115T_SHOW = FAQNAME + " Entry"
116T_LOG = "RCS log for %s entry" % FAQNAME
Guido van Rossum8bc49c81997-05-26 19:10:37 +0000117T_REVISION = "RCS revision for %s entry" % FAQNAME
Guido van Rossumea31ea21997-05-26 05:43:29 +0000118T_DIFF = "RCS diff for %s entry" % FAQNAME
119T_ADD = "Add an entry to the " + FAQNAME
120T_DELETE = "Deleting an entry from the " + FAQNAME
121T_EDIT = FAQNAME + " Edit Wizard"
122T_REVIEW = T_EDIT + " - Review Changes"
123T_COMMITTED = T_EDIT + " - Changes Committed"
124T_COMMITFAILED = T_EDIT + " - Commit Failed"
125T_CANTCOMMIT = T_EDIT + " - Commit Rejected"
126T_HELP = T_EDIT + " - Help"
127
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000128# Generic prologue and epilogue
129
130PROLOGUE = '''
131<HTML>
132<HEAD>
133<TITLE>%(title)s</TITLE>
134</HEAD>
135
136<BODY BACKGROUND="http://www.python.org/pics/RedShort.gif"
137 BGCOLOR="#FFFFFF"
138 TEXT="#000000"
139 LINK="#AA0000"
140 VLINK="#906A6A">
141<H1>%(title)s</H1>
142'''
143
144EPILOGUE = '''
145<HR>
146<A HREF="%(HOMEURL)s">%(HOMENAME)s</A> /
Guido van Rossumea31ea21997-05-26 05:43:29 +0000147<A HREF="%(FAQCGI)s?req=home">%(FAQNAME)s Wizard %(WIZVERSION)s</A> /
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000148Feedback to <A HREF="mailto:%(OWNEREMAIL)s">%(OWNERNAME)s</A>
149
150</BODY>
151</HTML>
152'''
153
154# Home page
155
156HOME = """
Guido van Rossumea31ea21997-05-26 05:43:29 +0000157<H2>Search the %(FAQNAME)s:</H2>
158
159<BLOCKQUOTE>
160
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000161<FORM ACTION="%(FAQCGI)s">
162 <INPUT TYPE=text NAME=query>
163 <INPUT TYPE=submit VALUE="Search"><BR>
Guido van Rossumea31ea21997-05-26 05:43:29 +0000164 <INPUT TYPE=radio NAME=querytype VALUE=simple CHECKED>
165 Simple string
166 /
167 <INPUT TYPE=radio NAME=querytype VALUE=regex>
168 Regular expression
Guido van Rossum8bc49c81997-05-26 19:10:37 +0000169 /<BR>
Guido van Rossumd9936951997-05-26 16:35:27 +0000170 <INPUT TYPE=radio NAME=querytype VALUE=anykeywords>
171 Keywords (any)
172 /
173 <INPUT TYPE=radio NAME=querytype VALUE=allkeywords>
174 Keywords (all)
Guido van Rossumea31ea21997-05-26 05:43:29 +0000175 <BR>
176 <INPUT TYPE=radio NAME=casefold VALUE=yes CHECKED>
177 Fold case
178 /
179 <INPUT TYPE=radio NAME=casefold VALUE=no>
180 Case sensitive
181 <BR>
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000182 <INPUT TYPE=hidden NAME=req VALUE=search>
183</FORM>
184
Guido van Rossumea31ea21997-05-26 05:43:29 +0000185</BLOCKQUOTE>
186
187<HR>
188
189<H2>Other forms of %(FAQNAME)s access:</H2>
190
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000191<UL>
192<LI><A HREF="%(FAQCGI)s?req=index">FAQ index</A>
193<LI><A HREF="%(FAQCGI)s?req=all">The whole FAQ</A>
Guido van Rossumea31ea21997-05-26 05:43:29 +0000194<LI><A HREF="%(FAQCGI)s?req=recent">What's new in the FAQ?</A>
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000195<LI><A HREF="%(FAQCGI)s?req=roulette">FAQ roulette</A>
Guido van Rossumea31ea21997-05-26 05:43:29 +0000196<LI><A HREF="%(FAQCGI)s?req=add">Add a FAQ entry</A>
197<LI><A HREF="%(FAQCGI)s?req=delete">Delete a FAQ entry</A>
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000198</UL>
199"""
200
201# Index formatting
202
203INDEX_SECTION = """
204<P>
205<HR>
Guido van Rossumea31ea21997-05-26 05:43:29 +0000206<H2>%(sec)s. %(title)s</H2>
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000207<UL>
208"""
209
Guido van Rossumea31ea21997-05-26 05:43:29 +0000210INDEX_ADDSECTION = """
211<P>
212<LI><A HREF="%(FAQCGI)s?req=new&amp;section=%(sec)s">Add new entry</A>
213(at this point)
214"""
215
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000216INDEX_ENDSECTION = """
217</UL>
218"""
219
220INDEX_ENTRY = """\
Guido van Rossum030144d1997-05-26 16:02:56 +0000221<LI><A HREF="%(FAQCGI)s?req=show&amp;file=%(file)s">%(title)s</A>
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000222"""
223
Guido van Rossum8bc49c81997-05-26 19:10:37 +0000224LOCAL_ENTRY = """\
225<LI><A HREF="#%(sec)s.%(num)s">%(title)s</A>
226"""
227
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000228# Entry formatting
229
Guido van Rossumfd67f731997-05-26 19:46:18 +0000230ENTRY_HEADER1 = """
Guido van Rossumea31ea21997-05-26 05:43:29 +0000231<HR>
Guido van Rossumfd67f731997-05-26 19:46:18 +0000232<H2><A NAME="%(sec)s.%(num)s">%(title)s</A>\
233"""
234
235ENTRY_HEADER2 = """\
236</H2>
Guido van Rossumea31ea21997-05-26 05:43:29 +0000237"""
238
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000239ENTRY_FOOTER = """
Guido van Rossumea31ea21997-05-26 05:43:29 +0000240<A HREF="%(FAQCGI)s?req=edit&amp;file=%(file)s">Edit this entry</A> /
241<A HREF="%(FAQCGI)s?req=log&amp;file=%(file)s">Log info</A>
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000242"""
243
244ENTRY_LOGINFO = """
245/ Last changed on %(last_changed_date)s by
246<A HREF="mailto:%(last_changed_email)s">%(last_changed_author)s</A>
247"""
248
249# Search
250
251NO_HITS = """
252No hits.
253"""
254
255ONE_HIT = """
256Your search matched the following entry:
257"""
258
259FEW_HITS = """
Guido van Rossumea31ea21997-05-26 05:43:29 +0000260Your search matched the following %(count)s entries:
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000261"""
262
263MANY_HITS = """
Guido van Rossumea31ea21997-05-26 05:43:29 +0000264Your search matched more than %(MAXHITS)s entries.
265The %(count)s matching entries are presented here ordered by section:
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000266"""
267
268# RCS log and diff
269
270LOG = """
271Click on a revision line to see the diff between that revision and the
272previous one.
273"""
274
Guido van Rossum8bc49c81997-05-26 19:10:37 +0000275REVISIONLINK = """\
276<A HREF="%(FAQCGI)s?req=revision&amp;file=%(file)s&amp;rev=%(rev)s"
277>%(line)s</A>\
278"""
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000279DIFFLINK = """\
Guido van Rossum8bc49c81997-05-26 19:10:37 +0000280 (<A HREF="%(FAQCGI)s?req=diff&amp;file=%(file)s&amp;\
281prev=%(prev)s&amp;rev=%(rev)s"
282>diff -r%(prev)s -r%(rev)s</A>)\
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000283"""
284
285# Recently changed entries
286
287NO_RECENT = """
288<HR>
289No %(FAQNAME)s entries were changed in the last %(period)s.
290"""
291
Guido van Rossumea31ea21997-05-26 05:43:29 +0000292VIEW_MENU = """
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000293<HR>
Guido van Rossumea31ea21997-05-26 05:43:29 +0000294View entries changed in the last...
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000295<UL>
Guido van Rossumea31ea21997-05-26 05:43:29 +0000296<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=1">24 hours</A>
297<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=2">2 days</A>
298<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=3">3 days</A>
299<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=7">week</A>
300<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=28">4 weeks</A>
301<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=365250">millennium</A>
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000302</UL>
Guido van Rossumea31ea21997-05-26 05:43:29 +0000303"""
304
305ONE_RECENT = VIEW_MENU + """
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000306The following %(FAQNAME)s entry was changed in the last %(period)s:
307"""
308
Guido van Rossumea31ea21997-05-26 05:43:29 +0000309SOME_RECENT = VIEW_MENU + """
310The following %(count)s %(FAQNAME)s entries were changed
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000311in the last %(period)s, most recently changed shown first:
312"""
313
Guido van Rossumea31ea21997-05-26 05:43:29 +0000314TAIL_RECENT = VIEW_MENU
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000315
316# Last changed banner on "all" (strftime format)
317LAST_CHANGED = "Last changed on %c %Z"
318
Guido van Rossumea31ea21997-05-26 05:43:29 +0000319# "Compat" command prologue (this has no <BODY> tag)
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000320COMPAT = """
321<H1>The whole %(FAQNAME)s</H1>
322"""
323
324# Editing
325
326EDITHEAD = """
327<A HREF="%(FAQCGI)s?req=help">Click for Help</A>
328"""
329
330REVIEWHEAD = EDITHEAD
331
332
333EDITFORM1 = """
334<FORM ACTION="%(FAQCGI)s" METHOD=POST>
335<INPUT TYPE=hidden NAME=req VALUE=review>
336<INPUT TYPE=hidden NAME=file VALUE=%(file)s>
337<INPUT TYPE=hidden NAME=editversion VALUE=%(editversion)s>
338<HR>
339"""
340
341EDITFORM2 = """
342Title: <INPUT TYPE=text SIZE=70 NAME=title VALUE="%(title)s"><BR>
343<TEXTAREA COLS=72 ROWS=20 NAME=body>%(body)s
344</TEXTAREA><BR>
345Log message (reason for the change):<BR>
346<TEXTAREA COLS=72 ROWS=5 NAME=log>%(log)s
347</TEXTAREA><BR>
348Please provide the following information for logging purposes:
349<TABLE FRAME=none COLS=2>
350 <TR>
351 <TD>Name:
352 <TD><INPUT TYPE=text SIZE=40 NAME=author VALUE="%(author)s">
353 <TR>
354 <TD>Email:
355 <TD><INPUT TYPE=text SIZE=40 NAME=email VALUE="%(email)s">
356 <TR>
357 <TD>Password:
358 <TD><INPUT TYPE=password SIZE=20 NAME=password VALUE="%(password)s">
359</TABLE>
360
361<INPUT TYPE=submit NAME=review VALUE="Preview Edit">
362Click this button to preview your changes.
363"""
364
365EDITFORM3 = """
366</FORM>
367"""
368
369COMMIT = """
370<INPUT TYPE=submit NAME=commit VALUE="Commit">
371Click this button to commit your changes.
372<HR>
373"""
374
375NOCOMMIT = """
Guido van Rossumea31ea21997-05-26 05:43:29 +0000376To commit your changes, please enter a log message, your name, email
377addres, and the correct password in the form below.
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000378<HR>
379"""
380
381CANTCOMMIT_HEAD = """
382Some required information is missing:
383<UL>
384"""
385NEED_PASSWD = "<LI>You must provide the correct passwd.\n"
386NEED_AUTHOR = "<LI>You must enter your name.\n"
387NEED_EMAIL = "<LI>You must enter your email address.\n"
388NEED_LOG = "<LI>You must enter a log message.\n"
389CANTCOMMIT_TAIL = """
390</UL>
391Please use your browser's Back command to correct the form and commit
392again.
393"""
394
Guido van Rossumea31ea21997-05-26 05:43:29 +0000395NEWCONFLICT = """
396<P>
397You are creating a new entry, but the entry number specified is not
398correct.
399<P>
400The two most common causes of this problem are:
401<UL>
402<LI>After creating the entry yourself, you went back in your browser,
403 edited the entry some more, and clicked Commit again.
404<LI>Someone else started creating a new entry in the same section and
405 committed before you did.
406</UL>
407(It is also possible that the last entry in the section was physically
408deleted, but this should not happen except through manual intervention
409by the FAQ maintainer.)
410<P>
411<A HREF="%(FAQCGI)s?req=new&amp;section=%(sec)s">Click here to try
412again.</A>
413<P>
414"""
415
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000416VERSIONCONFLICT = """
417<P>
418You edited version %(editversion)s but the current version is %(version)s.
419<P>
420The two most common causes of this problem are:
421<UL>
422<LI>After committing a change, you went back in your browser,
423 edited the entry some more, and clicked Commit again.
424<LI>Someone else started editing the same entry and committed
425 before you did.
426</UL>
427<P>
Guido van Rossumea31ea21997-05-26 05:43:29 +0000428<A HREF="%(FAQCGI)s?req=show&amp;file=%(file)s">Click here to reload
429the entry and try again.</A>
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000430<P>
431"""
432
433CANTWRITE = """
434Can't write file %(file)s (%(why)s).
435"""
436
437FILEHEADER = """\
438Title: %(title)s
439Last-Changed-Date: %(date)s
440Last-Changed-Author: %(author)s
441Last-Changed-Email: %(email)s
442Last-Changed-Remote-Host: %(REMOTE_HOST)s
443Last-Changed-Remote-Address: %(REMOTE_ADDR)s
444"""
445
446LOGHEADER = """\
447Last-Changed-Date: %(date)s
448Last-Changed-Author: %(author)s
449Last-Changed-Email: %(email)s
450Last-Changed-Remote-Host: %(REMOTE_HOST)s
451Last-Changed-Remote-Address: %(REMOTE_ADDR)s
452
453%(log)s
454"""
455
456COMMITTED = """
457Your changes have been committed.
458"""
459
460COMMITFAILED = """
461Exit status %(sts)04x.
462"""
463
Guido van Rossumea31ea21997-05-26 05:43:29 +0000464# Add/Delete
465
466ADD_HEAD = """
467At the moment, new entries can only be added at the end of a section.
468This is because the entry numbers are also their
469unique identifiers -- it's a bad idea to renumber entries.
470<P>
471Click on the section to which you want to add a new entry:
472<UL>
473"""
474
475ADD_SECTION = """\
476<LI><A HREF="%(FAQCGI)s?req=new&amp;section=%(section)s">%(section)s. %(title)s</A>
477"""
478
479ADD_TAIL = """
480</UL>
481"""
482
483DELETE = """
484At the moment, there's no direct way to delete entries.
485This is because the entry numbers are also their
486unique identifiers -- it's a bad idea to renumber entries.
487<P>
488If you really think an entry needs to be deleted,
489change the title to "(deleted)" and make the body
490empty (keep the entry number in the title though).
491"""
492
493# Help file for the FAQ Edit Wizard
494
Guido van Rossum1677e5b1997-05-26 00:07:18 +0000495HELP = """
496Using the %(FAQNAME)s Edit Wizard speaks mostly for itself. Here are
497some answers to questions you are likely to ask:
498
499<P><HR>
500
501<H2>I can review an entry but I can't commit it.</H2>
502
503The commit button only appears if the following conditions are met:
504
505<UL>
506
507<LI>The Name field is not empty.
508
509<LI>The Email field contains at least an @ character.
510
511<LI>The Log message box is not empty.
512
513<LI>The Password field contains the proper password.
514
515</UL>
516
517<P><HR>
518
519<H2>What is the password?</H2>
520
521At the moment, only PSA members will be told the password. This is a
522good time to join the PSA! See <A
523HREF="http://www.python.org/psa/">the PSA home page</A>.
524
525<P><HR>
526
527<H2>Can I use HTML in the FAQ entry?</H2>
528
529No, but if you include a URL or an email address in the text it will
530automatigally become an anchor of the right type. Also, *word*
531is made italic (but only for single alphabetic words).
532
533<P><HR>
534
535<H2>How do I delineate paragraphs?</H2>
536
537Use blank lines to separate paragraphs.
538
539<P><HR>
540
541<H2>How do I enter example text?</H2>
542
543Any line that begins with a space or tab is assumed to be part of
544literal text. Blocks of literal text delineated by blank lines are
545placed inside &lt;PRE&gt;...&lt;/PRE&gt;.
546"""