114 lines · 4.7 KB · Text
RawDownload
FAQ Wizard---------- Author: Guido van Rossum <guido@python.org>Version: 1.0Date:  6 April 1998  This is a CGI program that maintains a user-editable FAQ.  It uses RCSto keep track of changes to individual FAQ entries.  It is fullyconfigurable; everything you might want to change when using thisprogram to maintain some other FAQ than the Python FAQ is contained inthe configuration module, faqconf.py. Note that the bulk of the code is not an executable script; it's animportable module.  The actual script in cgi-bin is minimal. Files: faqw.py		executable script to be edited and installed in cgi-binfaqwiz.py	main module, lives in same directory as FAQ entry filesfaqconf.py	main configuration modulefaqcust.py	additional local customization module (optional)move-faqwiz.sh  Script to move faqwiz entries.  What's New?----------- Version 1.0 corrects some minor bugs and uses tab-agnosticindentation; it is otherwise unchanged from version 0.9.0. Version 0.9.0 uses the re module (Perl style regular expressions) forall its regular expression needs, instead of the regex and regsubmodules (Emacs style).  This affects the syntax for regularexpressions entered by the user as search strings (with "regularexpression" checked), hence the version number jump.  Setup Information----------------- This assumes you are familiar with Python, with your http server, andwith running CGI scripts under your http server.  You need Python 1.5or better. Select a place where the Python modules that constitute the FAQ wizardwill live (the directory where you unpacked it is an obvious choice).This will be called the SRCDIR.  This directory should not be writableby other users of your system (since they would be able to executearbitrary code by invoking the FAQ wizard's CGI script). Create a dedicated working directory, preferably one that's notdirectly reachable from your http server.  This will be called theFAQDIR.  Create a subdirectory named RCS.  Make both the workingdirectory and the RCS subdirectory wrld-writable.  (This is essential,since the FAQ wizard runs as use nobody, and needs to createadditional files here!) Edit faqconf.py to reflect your setup.  You only need to edit the toppart, up till the line of all dashes.  The comments should guide youin your edits.  (Actually, you can also choose to add your changes tofaqcust.py and leave faqconf.py alone.  This is essential if you aremaintaining multiple FAQs; see below.) Don't forget to edit the SECTION_TITLES variables to reflect the setof section titles for your FAQ! Next, edit faqw.py to reflect the pathname of your Python interpreterand the values for SRCDIR and FAQDIR that you just chose.  Theninstall faqw.py in your cgi-bin directory.  Make sure that it isworld-executable.  You should now be able to connect to the FAQ wizardby entering the following URL in your web client (subsituting theappropriate host and port for "your.web.server", and perhapsspecifying a different directory for "cgi-bin" if local conventions sodictate): 	http://your.web.server/cgi-bin/faqw.py If you are unable to get this working, check your server's error_logfile.  The documentation for Python's cgi module in the Python LibraryReference Manual gives plentyu additional information about installingand debugging CGI scripts, including setup debugging.  Thisdocumentation is repeated in the doc string in the cgi module; try``import cgi; print cgi.__doc__''. Assuming this works, you should now be able to add the first entry toyour FAQ using the FAQ wizard interface.  This creates a filefaq01.001.htp in your working directory and an RCS revision historyfile faq01.001.htp,v in the RCS subdirectory.  You can now exercisethe other FAQ wizard features (search, index, whole FAQ, what's new,roulette, and so on).  Maintaining Multiple FAQs------------------------- If you have multiple FAQs, you need a separate FAQDIR per FAQ, and adifferent customization file per FAQ.  The easiest thing to do wouldbe to have the faqcust.py for each FAQ live in the FAQDIR for thatFAQ, but that creates some security concerns, since the FAQDIR must beworld writable: *if* someone who breaks into your system (or alegitimate user) manages to edit the faqcust.py file they can getarbitrary code to execute through the FAQ wizard.  Therefore, you willneed a more complex setup. The best way is probably to have a directory that is only writable byyou for each FAQ, where you place the copy of faqcust.py for that FAQ,and have a world-writable subdirectory DATA for the data.  You thenset FAQDIR to point to the DATA directory and change the faqw.pybootstrap script to add FAQDIR/.. to sys.path (in front of SRCDIR, sothe dummy faqcust.py from SRCDIR is ignored). --Guido van Rossum (home page: http://www.python.org/~guido/)