1 """FAQ Wizard customization module.
3 Edit this file to customize the FAQ Wizard. For normal purposes, you
4 should only have to change the FAQ section titles and the small group
5 of parameters below it.
9 # Titles of FAQ sections
12 # SectionNumber : SectionTitle; need at least one entry
13 1: "General information and availability",
16 # Parameters you definitely want to change
18 SHORTNAME
= "Generic" # FAQ name with "FAQ" omitted
19 PASSWORD
= "" # Password for editing
20 OWNERNAME
= "FAQ owner" # Name for feedback
21 OWNEREMAIL
= "nobody@anywhere.org" # Email for feedback
22 HOMEURL
= "http://www.python.org" # Related home page
23 HOMENAME
= "Python home" # Name of related home page
24 RCSBINDIR
= "/usr/local/bin/" # Directory containing RCS commands
25 # (must end in a slash)
27 # Parameters you can normally leave alone
29 MAXHITS
= 10 # Max #hits to be shown directly
30 COOKIE_LIFETIME
= 28*24*3600 # Cookie expiration in seconds
31 # (28*24*3600 = 28 days = 4 weeks)
32 PROCESS_PREFORMAT
= 1 # toggle whether preformatted text
33 # will replace urls and emails with
36 # Markers appended to title to indicate recently change
37 # (may contain HTML, e.g. <IMG>); and corresponding
39 MARK_VERY_RECENT
= " **" # Changed very recently
40 MARK_RECENT
= " *" # Changed recently
41 DT_VERY_RECENT
= 24*3600 # 24 hours
42 DT_RECENT
= 7*24*3600 # 7 days
45 <P>(Entries marked with ** were changed within the last 24 hours;
46 entries marked with * were changed within the last 7 days.)
50 # Version -- don't change unless you edit faqwiz.py
52 WIZVERSION
= "1.0.4" # FAQ Wizard version
55 if os
.name
in ['nt',]:
56 # On NT we'll probably be running python from a batch file,
57 # so sys.argv[0] is not helpful
58 FAQCGI
= 'faq.bat' # Relative URL of the FAQ cgi script
59 # LOGNAME is not typically set on NT
60 os
.environ
[ 'LOGNAME' ] = "FAQWizard"
62 # This parameter is normally overwritten with a dynamic value
63 FAQCGI
= 'faqw.py' # Relative URL of the FAQ cgi script
64 FAQCGI
= os
.path
.basename(sys
.argv
[0]) or FAQCGI
67 # Perl (re module) style regular expression to recognize FAQ entry
68 # files: group(1) should be the section number, group(2) should be the
69 # question number. Both should be fixed width so simple-minded
70 # sorting yields the right order.
72 OKFILENAME
= r
"^faq(\d\d)\.(\d\d\d)\.htp$"
74 # Format to construct a FAQ entry file name
76 NEWFILENAME
= "faq%02d.%03d.htp"
78 # Load local customizations on top of the previous parameters
85 # Calculated parameter names
87 COOKIE_NAME
= SHORTNAME
+ "-FAQ-Wizard" # Name used for Netscape cookie
88 FAQNAME
= SHORTNAME
+ " FAQ" # Name of the FAQ
90 # ----------------------------------------------------------------------
92 # Anything below this point normally needn't be changed; you would
93 # change this if you were to create e.g. a French translation or if
94 # you just aren't happy with the text generated by the FAQ Wizard.
96 # Most strings here are subject to substitution (string%dictionary)
101 if os
.name
in ['nt', ]:
102 SH_RLOG
= RCSBINDIR
+ "rlog %(file)s < NUL"
103 SH_RLOG_H
= RCSBINDIR
+ "rlog -h %(file)s < NUL"
104 SH_RDIFF
= RCSBINDIR
+ "rcsdiff -r%(prev)s -r%(rev)s %(file)s < NUL"
105 SH_REVISION
= RCSBINDIR
+ "co -p%(rev)s %(file)s < NUL"
106 ### Have to use co -l, or the file is not marked rw on NT
107 SH_LOCK
= RCSBINDIR
+ "co -l %(file)s < NUL"
108 SH_CHECKIN
= RCSBINDIR
+ "ci -u %(file)s < %(tfn)s"
110 SH_RLOG
= RCSBINDIR
+ "rlog %(file)s </dev/null 2>&1"
111 SH_RLOG_H
= RCSBINDIR
+ "rlog -h %(file)s </dev/null 2>&1"
112 SH_RDIFF
= RCSBINDIR
+ "rcsdiff -r%(prev)s -r%(rev)s %(file)s </dev/null 2>&1"
113 SH_REVISION
= RCSBINDIR
+ "co -p%(rev)s %(file)s </dev/null 2>&1"
114 SH_LOCK
= RCSBINDIR
+ "rcs -l %(file)s </dev/null 2>&1"
115 SH_CHECKIN
= RCSBINDIR
+ "ci -u %(file)s <%(tfn)s 2>&1"
118 # Titles for various output pages (not subject to substitution)
120 T_HOME
= FAQNAME
+ " Wizard " + WIZVERSION
121 T_ERROR
= "Sorry, an error occurred"
122 T_ROULETTE
= FAQNAME
+ " Roulette"
123 T_ALL
= "The Whole " + FAQNAME
124 T_INDEX
= FAQNAME
+ " Index"
125 T_SEARCH
= FAQNAME
+ " Search Results"
126 T_RECENT
= "What's New in the " + FAQNAME
127 T_SHOW
= FAQNAME
+ " Entry"
128 T_LOG
= "RCS log for %s entry" % FAQNAME
129 T_REVISION
= "RCS revision for %s entry" % FAQNAME
130 T_DIFF
= "RCS diff for %s entry" % FAQNAME
131 T_ADD
= "Add an entry to the " + FAQNAME
132 T_DELETE
= "Deleting an entry from the " + FAQNAME
133 T_EDIT
= FAQNAME
+ " Edit Wizard"
134 T_REVIEW
= T_EDIT
+ " - Review Changes"
135 T_COMMITTED
= T_EDIT
+ " - Changes Committed"
136 T_COMMITFAILED
= T_EDIT
+ " - Commit Failed"
137 T_CANTCOMMIT
= T_EDIT
+ " - Commit Rejected"
138 T_HELP
= T_EDIT
+ " - Help"
140 # Generic prologue and epilogue
145 <TITLE>%(title)s</TITLE>
158 <A HREF="%(HOMEURL)s">%(HOMENAME)s</A> /
159 <A HREF="%(FAQCGI)s?req=home">%(FAQNAME)s Wizard %(WIZVERSION)s</A> /
160 Feedback to <A HREF="mailto:%(OWNEREMAIL)s">%(OWNERNAME)s</A>
169 <H2>Search the %(FAQNAME)s:</H2>
173 <FORM ACTION="%(FAQCGI)s">
174 <INPUT TYPE=text NAME=query>
175 <INPUT TYPE=submit VALUE="Search"><BR>
176 <INPUT TYPE=radio NAME=querytype VALUE=simple CHECKED>
179 <INPUT TYPE=radio NAME=querytype VALUE=regex>
182 <INPUT TYPE=radio NAME=querytype VALUE=anykeywords>
185 <INPUT TYPE=radio NAME=querytype VALUE=allkeywords>
188 <INPUT TYPE=radio NAME=casefold VALUE=yes CHECKED>
191 <INPUT TYPE=radio NAME=casefold VALUE=no>
194 <INPUT TYPE=hidden NAME=req VALUE=search>
201 <H2>Other forms of %(FAQNAME)s access:</H2>
204 <LI><A HREF="%(FAQCGI)s?req=index">FAQ index</A>
205 <LI><A HREF="%(FAQCGI)s?req=all">The whole FAQ</A>
206 <LI><A HREF="%(FAQCGI)s?req=recent">What's new in the FAQ?</A>
207 <LI><A HREF="%(FAQCGI)s?req=roulette">FAQ roulette</A>
208 <LI><A HREF="%(FAQCGI)s?req=add">Add a FAQ entry</A>
209 <LI><A HREF="%(FAQCGI)s?req=delete">Delete a FAQ entry</A>
218 <H2>%(sec)s. %(title)s</H2>
222 INDEX_ADDSECTION
= """
224 <LI><A HREF="%(FAQCGI)s?req=new&section=%(sec)s">Add new entry</A>
228 INDEX_ENDSECTION
= """
233 <LI><A HREF="%(FAQCGI)s?req=show&file=%(file)s">%(title)s</A>
237 <LI><A HREF="#%(sec)s.%(num)s">%(title)s</A>
244 <H2><A NAME="%(sec)s.%(num)s">%(title)s</A>\
252 <A HREF="%(FAQCGI)s?req=edit&file=%(file)s">Edit this entry</A> /
253 <A HREF="%(FAQCGI)s?req=log&file=%(file)s">Log info</A>
257 / Last changed on %(last_changed_date)s by
258 <A HREF="mailto:%(last_changed_email)s">%(last_changed_author)s</A>
268 Your search matched the following entry:
272 Your search matched the following %(count)s entries:
276 Your search matched more than %(MAXHITS)s entries.
277 The %(count)s matching entries are presented here ordered by section:
283 Click on a revision line to see the diff between that revision and the
288 <A HREF="%(FAQCGI)s?req=revision&file=%(file)s&rev=%(rev)s"
292 (<A HREF="%(FAQCGI)s?req=diff&file=%(file)s&\
293 prev=%(prev)s&rev=%(rev)s"
294 >diff -r%(prev)s -r%(rev)s</A>)\
297 # Recently changed entries
301 No %(FAQNAME)s entries were changed in the last %(period)s.
306 View entries changed in the last...
308 <LI><A HREF="%(FAQCGI)s?req=recent&days=1">24 hours</A>
309 <LI><A HREF="%(FAQCGI)s?req=recent&days=2">2 days</A>
310 <LI><A HREF="%(FAQCGI)s?req=recent&days=3">3 days</A>
311 <LI><A HREF="%(FAQCGI)s?req=recent&days=7">week</A>
312 <LI><A HREF="%(FAQCGI)s?req=recent&days=28">4 weeks</A>
313 <LI><A HREF="%(FAQCGI)s?req=recent&days=365250">millennium</A>
317 ONE_RECENT
= VIEW_MENU
+ """
318 The following %(FAQNAME)s entry was changed in the last %(period)s:
321 SOME_RECENT
= VIEW_MENU
+ """
322 The following %(count)s %(FAQNAME)s entries were changed
323 in the last %(period)s, most recently changed shown first:
326 TAIL_RECENT
= VIEW_MENU
328 # Last changed banner on "all" (strftime format)
329 LAST_CHANGED
= "Last changed on %c %Z"
331 # "Compat" command prologue (this has no <BODY> tag)
333 <H1>The whole %(FAQNAME)s</H1>
334 See also the <A HREF="%(FAQCGI)s?req=home">%(FAQNAME)s Wizard</A>.
341 <A HREF="%(FAQCGI)s?req=help">Click for Help</A>
344 REVIEWHEAD
= EDITHEAD
348 <FORM ACTION="%(FAQCGI)s" METHOD=POST>
349 <INPUT TYPE=hidden NAME=req VALUE=review>
350 <INPUT TYPE=hidden NAME=file VALUE=%(file)s>
351 <INPUT TYPE=hidden NAME=editversion VALUE=%(editversion)s>
356 Title: <INPUT TYPE=text SIZE=70 NAME=title VALUE="%(title)s"><BR>
357 <TEXTAREA COLS=72 ROWS=20 NAME=body>%(body)s
359 Log message (reason for the change):<BR>
360 <TEXTAREA COLS=72 ROWS=5 NAME=log>%(log)s
362 Please provide the following information for logging purposes:
363 <TABLE FRAME=none COLS=2>
366 <TD><INPUT TYPE=text SIZE=40 NAME=author VALUE="%(author)s">
369 <TD><INPUT TYPE=text SIZE=40 NAME=email VALUE="%(email)s">
372 <TD><INPUT TYPE=password SIZE=20 NAME=password VALUE="%(password)s">
375 <INPUT TYPE=submit NAME=review VALUE="Preview Edit">
376 Click this button to preview your changes.
384 <INPUT TYPE=submit NAME=commit VALUE="Commit">
385 Click this button to commit your changes.
390 To commit your changes, please correct the following errors in the
391 form below and click the Preview Edit button.
399 CANTCOMMIT_HEAD
= """
400 Some required information is missing:
403 NEED_PASSWD
= "<LI>You must provide the correct password.\n"
404 NEED_AUTHOR
= "<LI>You must enter your name.\n"
405 NEED_EMAIL
= "<LI>You must enter your email address.\n"
406 NEED_LOG
= "<LI>You must enter a log message.\n"
407 CANTCOMMIT_TAIL
= """
409 Please use your browser's Back command to correct the form and commit
415 You are creating a new entry, but the entry number specified is not
418 The two most common causes of this problem are:
420 <LI>After creating the entry yourself, you went back in your browser,
421 edited the entry some more, and clicked Commit again.
422 <LI>Someone else started creating a new entry in the same section and
423 committed before you did.
425 (It is also possible that the last entry in the section was physically
426 deleted, but this should not happen except through manual intervention
427 by the FAQ maintainer.)
429 <A HREF="%(FAQCGI)s?req=new&section=%(sec)s">Click here to try
434 VERSIONCONFLICT
= """
436 You edited version %(editversion)s but the current version is %(version)s.
438 The two most common causes of this problem are:
440 <LI>After committing a change, you went back in your browser,
441 edited the entry some more, and clicked Commit again.
442 <LI>Someone else started editing the same entry and committed
446 <A HREF="%(FAQCGI)s?req=show&file=%(file)s">Click here to reload
447 the entry and try again.</A>
452 Can't write file %(file)s (%(why)s).
457 Last-Changed-Date: %(date)s
458 Last-Changed-Author: %(author)s
459 Last-Changed-Email: %(email)s
460 Last-Changed-Remote-Host: %(REMOTE_HOST)s
461 Last-Changed-Remote-Address: %(REMOTE_ADDR)s
465 Last-Changed-Date: %(date)s
466 Last-Changed-Author: %(author)s
467 Last-Changed-Email: %(email)s
468 Last-Changed-Remote-Host: %(REMOTE_HOST)s
469 Last-Changed-Remote-Address: %(REMOTE_ADDR)s
475 Your changes have been committed.
485 At the moment, new entries can only be added at the end of a section.
486 This is because the entry numbers are also their
487 unique identifiers -- it's a bad idea to renumber entries.
489 Click on the section to which you want to add a new entry:
494 <LI><A HREF="%(FAQCGI)s?req=new&section=%(section)s">%(section)s. %(title)s</A>
502 <P>Hit your browser's Reload button to play again.<P>
506 At the moment, there's no direct way to delete entries.
507 This is because the entry numbers are also their
508 unique identifiers -- it's a bad idea to renumber entries.
510 If you really think an entry needs to be deleted,
511 change the title to "(deleted)" and make the body
512 empty (keep the entry number in the title though).
515 # Help file for the FAQ Edit Wizard
518 Using the %(FAQNAME)s Edit Wizard speaks mostly for itself. Here are
519 some answers to questions you are likely to ask:
523 <H2>I can review an entry but I can't commit it.</H2>
525 The commit button only appears if the following conditions are met:
529 <LI>The Name field is not empty.
531 <LI>The Email field contains at least an @ character.
533 <LI>The Log message box is not empty.
535 <LI>The Password field contains the proper password.
541 <H2>What is the password?</H2>
543 At the moment, only PSA members will be told the password. This is a
544 good time to join the PSA! See <A
545 HREF="http://www.python.org/psa/">the PSA home page</A>.
549 <H2>Can I use HTML in the FAQ entry?</H2>
551 Yes, if you include it in <HTML&rt; and </HTML> tags.
553 Also, if you include a URL or an email address in the text it will
554 automatigally become an anchor of the right type. Also, *word*
555 is made italic (but only for single alphabetic words).
559 <H2>How do I delineate paragraphs?</H2>
561 Use blank lines to separate paragraphs.
565 <H2>How do I enter example text?</H2>
567 Any line that begins with a space or tab is assumed to be part of
568 literal text. Blocks of literal text delineated by blank lines are
569 placed inside <PRE>...</PRE>.
572 # Load local customizations again, in case they set some other variables
575 from faqcust
import *