From f1ead1a63c879906df346959816337213a11715b Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 28 Aug 1997 02:38:01 +0000 Subject: 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 ... feature suggested by Skip Montanaro. Added leading text for Roulette, default to 'Hit Reload ...'. Fix typo in default SRCDIR. --- Tools/faqwiz/README | 39 +++++++++++++++++++++++---------------- Tools/faqwiz/faqconf.py | 6 +++++- Tools/faqwiz/faqw.py | 18 +++++++++++++++++- Tools/faqwiz/faqwiz.py | 32 +++++++++++++++----------------- 4 files changed, 60 insertions(+), 35 deletions(-) diff --git a/Tools/faqwiz/README b/Tools/faqwiz/README index 9bcd7a0..bbcf1e3 100644 --- a/Tools/faqwiz/README +++ b/Tools/faqwiz/README @@ -2,8 +2,8 @@ FAQ Wizard ---------- Author: Guido van Rossum -Version: 0.7 -Date: 14 August 1997 +Version: 0.8 +Date: 27 August 1997 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 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 -directly reachable from your http server. Drop the Python modules -mentioned above in the working directory. Create a subdirectory named -RCS. Make both the working directory and the RCS subdirectory -wrld-writable. (This is essential, since the FAQ wizard runs as use -nobody, and needs to create additional files here!) +directly reachable from your http server. This will be called the +FAQDIR. Create a subdirectory named RCS. Make both the working +directory and the RCS subdirectory wrld-writable. (This is essential, +since the FAQ wizard runs as use nobody, and needs to create +additional files here!) 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 @@ -45,12 +51,13 @@ Don't forget to edit the SECTION_TITLES variables to reflect the set of section titles for your FAQ! 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 -directory. Make sure that it is world-executable. You should now be -able to connect to the FAQ wizard by entering the following URL in -your web client (subsituting the appropriate host and port for -"your.web.server", and perhaps specifying a different directory for -"cgi-bin" if local conventions so dictate): +and the values for SRCDIR and FAQDIR that you just chose. Then +install faqw.py in your cgi-bin directory. Make sure that it is +world-executable. You should now be able to connect to the FAQ wizard +by entering the following URL in your web client (subsituting the +appropriate host and port for "your.web.server", and perhaps +specifying a different directory for "cgi-bin" if local conventions so +dictate): 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 ``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 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 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/) diff --git a/Tools/faqwiz/faqconf.py b/Tools/faqwiz/faqconf.py index 27ddcf9..9a5b000 100644 --- a/Tools/faqwiz/faqconf.py +++ b/Tools/faqwiz/faqconf.py @@ -46,7 +46,7 @@ entries marked with * were changed within the last 7 days.) # 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 @@ -472,6 +472,10 @@ ADD_TAIL = """ """ +ROULETTE = """ +

Hit your browser's Reload button to play again.

+""" + DELETE = """ At the moment, there's no direct way to delete entries. This is because the entry numbers are also their diff --git a/Tools/faqwiz/faqw.py b/Tools/faqwiz/faqw.py index 8d5ab09..9babc7a 100755 --- a/Tools/faqwiz/faqw.py +++ b/Tools/faqwiz/faqw.py @@ -1,9 +1,25 @@ #! /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 t1 = posix.times() try: 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 os.chdir(FAQDIR) sys.path.insert(0, SRCDIR) diff --git a/Tools/faqwiz/faqwiz.py b/Tools/faqwiz/faqwiz.py index d380670..5ceb2f9 100644 --- a/Tools/faqwiz/faqwiz.py +++ b/Tools/faqwiz/faqwiz.py @@ -7,8 +7,7 @@ program to maintain some other FAQ than the Python FAQ is contained in the configuration module, faqconf.py. 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 -file as a string literal. +The actual script to place in cgi-bin is faqw.py. """ @@ -263,7 +262,20 @@ class FaqEntry: self.emit_marks() emit(ENTRY_HEADER2, self) pre = 0 + raw = 0 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 == '': + raw = 1 + continue + if tag == '': + raw = 0 + continue + if raw: + print line + continue if not string.strip(line): if pre: print '' @@ -578,6 +590,7 @@ class FaqWizard: return file = whrandom.choice(files) self.prologue(T_ROULETTE) + emit(ROULETTE) self.dir.show(file) def do_help(self): @@ -818,18 +831,3 @@ class FaqWizard: wiz = FaqWizard() 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 -""" -- cgit v0.12