mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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.
This commit is contained in:
parent
8a2d216047
commit
f1ead1a63c
4 changed files with 60 additions and 35 deletions
|
@ -2,8 +2,8 @@ FAQ Wizard
|
||||||
----------
|
----------
|
||||||
|
|
||||||
Author: Guido van Rossum <guido@python.org>
|
Author: Guido van Rossum <guido@python.org>
|
||||||
Version: 0.7
|
Version: 0.8
|
||||||
Date: 14 August 1997
|
Date: 27 August 1997
|
||||||
|
|
||||||
|
|
||||||
This is a CGI program that maintains a user-editable FAQ. It uses RCS
|
This is a CGI program that maintains a user-editable FAQ. It uses RCS
|
||||||
|
@ -27,14 +27,20 @@ Setup Information
|
||||||
|
|
||||||
This assumes you are familiar with Python, with your http server, and
|
This assumes you are familiar with Python, with your http server, and
|
||||||
with running CGI scripts under your http server. You need Python 1.4
|
with running CGI scripts under your http server. You need Python 1.4
|
||||||
or better.
|
or better.
|
||||||
|
|
||||||
|
Select a place where the Python modules that constitute the FAQ wizard
|
||||||
|
will live (the directory where you unpacked it is an obvious choice).
|
||||||
|
This will be called the SRCDIR. This directory should not be writable
|
||||||
|
by other users of your system (since they would be able to execute
|
||||||
|
arbitrary code by invoking the FAQ wizard's CGI script).
|
||||||
|
|
||||||
Create a dedicated working directory, preferably one that's not
|
Create a dedicated working directory, preferably one that's not
|
||||||
directly reachable from your http server. Drop the Python modules
|
directly reachable from your http server. This will be called the
|
||||||
mentioned above in the working directory. Create a subdirectory named
|
FAQDIR. Create a subdirectory named RCS. Make both the working
|
||||||
RCS. Make both the working directory and the RCS subdirectory
|
directory and the RCS subdirectory wrld-writable. (This is essential,
|
||||||
wrld-writable. (This is essential, since the FAQ wizard runs as use
|
since the FAQ wizard runs as use nobody, and needs to create
|
||||||
nobody, and needs to create additional files here!)
|
additional files here!)
|
||||||
|
|
||||||
Edit faqconf.py to reflect your setup. You only need to edit the top
|
Edit faqconf.py to reflect your setup. You only need to edit the top
|
||||||
part, up till the line of all dashes. The comments should guide you
|
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
|
||||||
of section titles for your FAQ!
|
of section titles for your FAQ!
|
||||||
|
|
||||||
Next, edit faqw.py to reflect the pathname of your Python interpreter
|
Next, edit faqw.py to reflect the pathname of your Python interpreter
|
||||||
and the directory you just created. Then install in in your cgi-bin
|
and the values for SRCDIR and FAQDIR that you just chose. Then
|
||||||
directory. Make sure that it is world-executable. You should now be
|
install faqw.py in your cgi-bin directory. Make sure that it is
|
||||||
able to connect to the FAQ wizard by entering the following URL in
|
world-executable. You should now be able to connect to the FAQ wizard
|
||||||
your web client (subsituting the appropriate host and port for
|
by entering the following URL in your web client (subsituting the
|
||||||
"your.web.server", and perhaps specifying a different directory for
|
appropriate host and port for "your.web.server", and perhaps
|
||||||
"cgi-bin" if local conventions so dictate):
|
specifying a different directory for "cgi-bin" if local conventions so
|
||||||
|
dictate):
|
||||||
|
|
||||||
http://your.web.server/cgi-bin/faqw.py
|
http://your.web.server/cgi-bin/faqw.py
|
||||||
|
|
||||||
|
@ -61,11 +68,11 @@ and debugging CGI scripts, including setup debugging. This
|
||||||
documentation is repeated in the doc string in the cgi module; try
|
documentation is repeated in the doc string in the cgi module; try
|
||||||
``import cgi; print cgi.__doc__''.
|
``import cgi; print cgi.__doc__''.
|
||||||
|
|
||||||
Assuming this woks, you should now be able to add the first entry to
|
Assuming this works, you should now be able to add the first entry to
|
||||||
your FAQ using the FAQ wizard interface. This creates a file
|
your FAQ using the FAQ wizard interface. This creates a file
|
||||||
faq01.001.htp in your working directory and an RCS revision history
|
faq01.001.htp in your working directory and an RCS revision history
|
||||||
file faq01.001.htp,v in the RCS subdirectory. You can now exercise
|
file faq01.001.htp,v in the RCS subdirectory. You can now exercise
|
||||||
the other FAQ wizard features (search, index, whole FAQ, what's new,
|
the other FAQ wizard features (search, index, whole FAQ, what's new,
|
||||||
and roulette).
|
roulette, and so on).
|
||||||
|
|
||||||
--Guido van Rossum (home page: http://www.python.org/~guido/)
|
--Guido van Rossum (home page: http://www.python.org/~guido/)
|
||||||
|
|
|
@ -46,7 +46,7 @@ entries marked with * were changed within the last 7 days.)
|
||||||
|
|
||||||
# Version -- don't change unless you edit faqwiz.py
|
# Version -- don't change unless you edit faqwiz.py
|
||||||
|
|
||||||
WIZVERSION = "0.6" # FAQ Wizard version
|
WIZVERSION = "0.8" # FAQ Wizard version
|
||||||
|
|
||||||
# This parameter is normally overwritten with a dynamic value
|
# This parameter is normally overwritten with a dynamic value
|
||||||
|
|
||||||
|
@ -472,6 +472,10 @@ ADD_TAIL = """
|
||||||
</UL>
|
</UL>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
ROULETTE = """
|
||||||
|
<P>Hit your browser's Reload button to play again.<P>
|
||||||
|
"""
|
||||||
|
|
||||||
DELETE = """
|
DELETE = """
|
||||||
At the moment, there's no direct way to delete entries.
|
At the moment, there's no direct way to delete entries.
|
||||||
This is because the entry numbers are also their
|
This is because the entry numbers are also their
|
||||||
|
|
|
@ -1,9 +1,25 @@
|
||||||
#! /usr/local/bin/python
|
#! /usr/local/bin/python
|
||||||
|
|
||||||
|
"""FAQ wizard bootstrap."""
|
||||||
|
|
||||||
|
# This is a longer version of the bootstrap script given at the end of
|
||||||
|
# faqwin.py; it prints timing statistics at the end of the regular CGI
|
||||||
|
# script's output (so you can monitor how it is doing).
|
||||||
|
|
||||||
|
# This script should be placed in your cgi-bin directory and made
|
||||||
|
# executable.
|
||||||
|
|
||||||
|
# You need to edit the first line and the lines that define FAQDIR and
|
||||||
|
# SRCDIR, below: change /usr/local/bin/python to where your Python
|
||||||
|
# interpreter lives, change the value for FAQDIR to where your FAQ
|
||||||
|
# lives, and change the value for SRCDIR to where your faqwiz.py
|
||||||
|
# module lives. The faqconf.py and faqcust.py files live there, too.
|
||||||
|
|
||||||
import posix
|
import posix
|
||||||
t1 = posix.times()
|
t1 = posix.times()
|
||||||
try:
|
try:
|
||||||
FAQDIR = "/usr/people/guido/python/FAQ"
|
FAQDIR = "/usr/people/guido/python/FAQ"
|
||||||
SRCDIR = "/usr/people/guido/python/Tools/faqwiz"
|
SRCDIR = "/usr/people/guido/python/src/Tools/faqwiz"
|
||||||
import os, sys, time, operator
|
import os, sys, time, operator
|
||||||
os.chdir(FAQDIR)
|
os.chdir(FAQDIR)
|
||||||
sys.path.insert(0, SRCDIR)
|
sys.path.insert(0, SRCDIR)
|
||||||
|
|
|
@ -7,8 +7,7 @@ program to maintain some other FAQ than the Python FAQ is contained in
|
||||||
the configuration module, faqconf.py.
|
the configuration module, faqconf.py.
|
||||||
|
|
||||||
Note that this is not an executable script; it's an importable module.
|
Note that this is not an executable script; it's an importable module.
|
||||||
The actual script in cgi-bin minimal; it's appended at the end of this
|
The actual script to place in cgi-bin is faqw.py.
|
||||||
file as a string literal.
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -263,7 +262,20 @@ class FaqEntry:
|
||||||
self.emit_marks()
|
self.emit_marks()
|
||||||
emit(ENTRY_HEADER2, self)
|
emit(ENTRY_HEADER2, self)
|
||||||
pre = 0
|
pre = 0
|
||||||
|
raw = 0
|
||||||
for line in string.split(self.body, '\n'):
|
for line in string.split(self.body, '\n'):
|
||||||
|
# Allow the user to insert raw html into a FAQ answer
|
||||||
|
# (Skip Montanaro, with changes by Guido)
|
||||||
|
tag = string.lower(string.rstrip(line))
|
||||||
|
if tag == '<html>':
|
||||||
|
raw = 1
|
||||||
|
continue
|
||||||
|
if tag == '</html>':
|
||||||
|
raw = 0
|
||||||
|
continue
|
||||||
|
if raw:
|
||||||
|
print line
|
||||||
|
continue
|
||||||
if not string.strip(line):
|
if not string.strip(line):
|
||||||
if pre:
|
if pre:
|
||||||
print '</PRE>'
|
print '</PRE>'
|
||||||
|
@ -578,6 +590,7 @@ class FaqWizard:
|
||||||
return
|
return
|
||||||
file = whrandom.choice(files)
|
file = whrandom.choice(files)
|
||||||
self.prologue(T_ROULETTE)
|
self.prologue(T_ROULETTE)
|
||||||
|
emit(ROULETTE)
|
||||||
self.dir.show(file)
|
self.dir.show(file)
|
||||||
|
|
||||||
def do_help(self):
|
def do_help(self):
|
||||||
|
@ -818,18 +831,3 @@ class FaqWizard:
|
||||||
|
|
||||||
wiz = FaqWizard()
|
wiz = FaqWizard()
|
||||||
wiz.go()
|
wiz.go()
|
||||||
|
|
||||||
# This bootstrap script should be placed in your cgi-bin directory.
|
|
||||||
# You only need to edit the first two lines: change
|
|
||||||
# /usr/local/bin/python to where your Python interpreter lives change
|
|
||||||
# the value for FAQDIR to where your FAQ lives. The faqwiz.py and
|
|
||||||
# faqconf.py files should live there, too.
|
|
||||||
|
|
||||||
BOOTSTRAP = """\
|
|
||||||
#! /usr/local/bin/python
|
|
||||||
FAQDIR = "/usr/people/guido/python/FAQ"
|
|
||||||
import sys, os
|
|
||||||
os.chdir(FAQDIR)
|
|
||||||
sys.path.insert(0, FAQDIR)
|
|
||||||
import faqwiz
|
|
||||||
"""
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue