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

Skip to content

Commit f1ead1a

Browse files
committed
New installation instructions show how to maintain multiple FAQs.
Removed bootstrap script from end of faqwiz.py module. Added instructions to bootstrap script, too. Version bumped to 0.8. Added <html>...</html> feature suggested by Skip Montanaro. Added leading text for Roulette, default to 'Hit Reload ...'. Fix typo in default SRCDIR.
1 parent 8a2d216 commit f1ead1a

4 files changed

Lines changed: 60 additions & 35 deletions

File tree

Tools/faqwiz/README

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ FAQ Wizard
22
----------
33

44
Author: Guido van Rossum <[email protected]>
5-
Version: 0.7
6-
Date: 14 August 1997
5+
Version: 0.8
6+
Date: 27 August 1997
77

88

99
This is a CGI program that maintains a user-editable FAQ. It uses RCS
@@ -27,14 +27,20 @@ Setup Information
2727

2828
This assumes you are familiar with Python, with your http server, and
2929
with running CGI scripts under your http server. You need Python 1.4
30-
or better.
30+
or better.
31+
32+
Select a place where the Python modules that constitute the FAQ wizard
33+
will live (the directory where you unpacked it is an obvious choice).
34+
This will be called the SRCDIR. This directory should not be writable
35+
by other users of your system (since they would be able to execute
36+
arbitrary code by invoking the FAQ wizard's CGI script).
3137

3238
Create a dedicated working directory, preferably one that's not
33-
directly reachable from your http server. Drop the Python modules
34-
mentioned above in the working directory. Create a subdirectory named
35-
RCS. Make both the working directory and the RCS subdirectory
36-
wrld-writable. (This is essential, since the FAQ wizard runs as use
37-
nobody, and needs to create additional files here!)
39+
directly reachable from your http server. This will be called the
40+
FAQDIR. Create a subdirectory named RCS. Make both the working
41+
directory and the RCS subdirectory wrld-writable. (This is essential,
42+
since the FAQ wizard runs as use nobody, and needs to create
43+
additional files here!)
3844

3945
Edit faqconf.py to reflect your setup. You only need to edit the top
4046
part, up till the line of all dashes. The comments should guide you
@@ -45,12 +51,13 @@ Don't forget to edit the SECTION_TITLES variables to reflect the set
4551
of section titles for your FAQ!
4652

4753
Next, edit faqw.py to reflect the pathname of your Python interpreter
48-
and the directory you just created. Then install in in your cgi-bin
49-
directory. Make sure that it is world-executable. You should now be
50-
able to connect to the FAQ wizard by entering the following URL in
51-
your web client (subsituting the appropriate host and port for
52-
"your.web.server", and perhaps specifying a different directory for
53-
"cgi-bin" if local conventions so dictate):
54+
and the values for SRCDIR and FAQDIR that you just chose. Then
55+
install faqw.py in your cgi-bin directory. Make sure that it is
56+
world-executable. You should now be able to connect to the FAQ wizard
57+
by entering the following URL in your web client (subsituting the
58+
appropriate host and port for "your.web.server", and perhaps
59+
specifying a different directory for "cgi-bin" if local conventions so
60+
dictate):
5461

5562
http://your.web.server/cgi-bin/faqw.py
5663

@@ -61,11 +68,11 @@ and debugging CGI scripts, including setup debugging. This
6168
documentation is repeated in the doc string in the cgi module; try
6269
``import cgi; print cgi.__doc__''.
6370

64-
Assuming this woks, you should now be able to add the first entry to
71+
Assuming this works, you should now be able to add the first entry to
6572
your FAQ using the FAQ wizard interface. This creates a file
6673
faq01.001.htp in your working directory and an RCS revision history
6774
file faq01.001.htp,v in the RCS subdirectory. You can now exercise
6875
the other FAQ wizard features (search, index, whole FAQ, what's new,
69-
and roulette).
76+
roulette, and so on).
7077

7178
--Guido van Rossum (home page: http://www.python.org/~guido/)

Tools/faqwiz/faqconf.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
# Version -- don't change unless you edit faqwiz.py
4848

49-
WIZVERSION = "0.6" # FAQ Wizard version
49+
WIZVERSION = "0.8" # FAQ Wizard version
5050

5151
# This parameter is normally overwritten with a dynamic value
5252

@@ -472,6 +472,10 @@
472472
</UL>
473473
"""
474474

475+
ROULETTE = """
476+
<P>Hit your browser's Reload button to play again.<P>
477+
"""
478+
475479
DELETE = """
476480
At the moment, there's no direct way to delete entries.
477481
This is because the entry numbers are also their

Tools/faqwiz/faqw.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
11
#! /usr/local/bin/python
2+
3+
"""FAQ wizard bootstrap."""
4+
5+
# This is a longer version of the bootstrap script given at the end of
6+
# faqwin.py; it prints timing statistics at the end of the regular CGI
7+
# script's output (so you can monitor how it is doing).
8+
9+
# This script should be placed in your cgi-bin directory and made
10+
# executable.
11+
12+
# You need to edit the first line and the lines that define FAQDIR and
13+
# SRCDIR, below: change /usr/local/bin/python to where your Python
14+
# interpreter lives, change the value for FAQDIR to where your FAQ
15+
# lives, and change the value for SRCDIR to where your faqwiz.py
16+
# module lives. The faqconf.py and faqcust.py files live there, too.
17+
218
import posix
319
t1 = posix.times()
420
try:
521
FAQDIR = "/usr/people/guido/python/FAQ"
6-
SRCDIR = "/usr/people/guido/python/Tools/faqwiz"
22+
SRCDIR = "/usr/people/guido/python/src/Tools/faqwiz"
723
import os, sys, time, operator
824
os.chdir(FAQDIR)
925
sys.path.insert(0, SRCDIR)

Tools/faqwiz/faqwiz.py

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
the configuration module, faqconf.py.
88
99
Note that this is not an executable script; it's an importable module.
10-
The actual script in cgi-bin minimal; it's appended at the end of this
11-
file as a string literal.
10+
The actual script to place in cgi-bin is faqw.py.
1211
1312
"""
1413

@@ -263,7 +262,20 @@ def show(self, edit=1):
263262
self.emit_marks()
264263
emit(ENTRY_HEADER2, self)
265264
pre = 0
265+
raw = 0
266266
for line in string.split(self.body, '\n'):
267+
# Allow the user to insert raw html into a FAQ answer
268+
# (Skip Montanaro, with changes by Guido)
269+
tag = string.lower(string.rstrip(line))
270+
if tag == '<html>':
271+
raw = 1
272+
continue
273+
if tag == '</html>':
274+
raw = 0
275+
continue
276+
if raw:
277+
print line
278+
continue
267279
if not string.strip(line):
268280
if pre:
269281
print '</PRE>'
@@ -578,6 +590,7 @@ def do_roulette(self):
578590
return
579591
file = whrandom.choice(files)
580592
self.prologue(T_ROULETTE)
593+
emit(ROULETTE)
581594
self.dir.show(file)
582595

583596
def do_help(self):
@@ -818,18 +831,3 @@ def commit(self, entry):
818831

819832
wiz = FaqWizard()
820833
wiz.go()
821-
822-
# This bootstrap script should be placed in your cgi-bin directory.
823-
# You only need to edit the first two lines: change
824-
# /usr/local/bin/python to where your Python interpreter lives change
825-
# the value for FAQDIR to where your FAQ lives. The faqwiz.py and
826-
# faqconf.py files should live there, too.
827-
828-
BOOTSTRAP = """\
829-
#! /usr/local/bin/python
830-
FAQDIR = "/usr/people/guido/python/FAQ"
831-
import sys, os
832-
os.chdir(FAQDIR)
833-
sys.path.insert(0, FAQDIR)
834-
import faqwiz
835-
"""

0 commit comments

Comments
 (0)