Skip to content

Commit

Permalink
removed doc
Browse files Browse the repository at this point in the history
  • Loading branch information
gtrubetskoy committed Dec 14, 2000
1 parent 9b0f7f5 commit 12f1fee
Show file tree
Hide file tree
Showing 17 changed files with 121 additions and 2,883 deletions.
15 changes: 7 additions & 8 deletions Doc/appendixa.tex
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ \chapter{Windows Installation\label{app-wininst}}

\item
Use Winzip to extract the distribution file (mod_python-x.tgz) into a
temporary folder (i.e C:$\backslash$temp):
temporary folder (i.e \code{C:\e temp}):

\item
NOTE: If Winzip shows this warning "Archive contains one file, should
Expand All @@ -48,16 +48,16 @@ \chapter{Windows Installation\label{app-wininst}}
\item
Open your Windows Explorer and locate the temporary folder where you
extracted the distribution file, you should have a new folder in your
temporary folder (C:$\backslash$temp$\backslash$mod_python-x ).
temporary folder (\code{C:\e temp\e mod_python-x}).

\item
Move (or just drag \& drop) the mod_python-x folder into the Python lib
folder (i.e C:$\backslash$Program Files$\backslash$Python$\backslash$lib).
folder (i.e \code{C:\e Program Files\e Python\e lib}).

\item
Move the files in the folder lib inside the mod_python folder
(C:$\backslash$Program Files$\backslash$Python$\backslash$lib$\backslash$mod_python-x$\backslash$lib$\backslash$mod_python ) to the
C:$\backslash$Program Files$\backslash$Python$\backslash$lib$\backslash$mod_python folder. It's safe to delete
(\code{C:\e Program Files\e Python\e lib\e mod_python-x\e lib\e mod_python}) to the
\code{C:\e Program Files\e Python\e lib\e mod_python} folder. It's safe to delete
these folders we just emptied.

\end{itemize}
Expand All @@ -75,11 +75,10 @@ \chapter{Windows Installation\label{app-wininst}}

\item
Locate the file mod_python.dll that you downloaded before and move it
to Apache's modules folder (i.e C:$\backslash$Program Files$\backslash$Apache
Group$\backslash$Apache$\backslash$modules).
to Apache's modules folder (i.e \code{C:\e Program Files\e Apache Group\e Apache\e modules}).

\item
Go to the Apache configuration folder (i.e C:$\backslash$Program Files$\backslash$Apache Group$\backslash$Apache$\backslash$conf$\backslash$) and edit the httpd.conf file.
Go to the Apache configuration folder (i.e \code{C:\e Program Files\e Apache Group\e Apache\e conf\e }) and edit the httpd.conf file.

Add the following line in the section "Dynamic Shared Object (DSO)
Support" of the httpd.conf file:
Expand Down
111 changes: 109 additions & 2 deletions Doc/modpython3.tex
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ \section{So what Exactly does Mod-python do?\label{tut-what-it-do}}

\emph{At this point, if you didn't understand the above paragraph, go back and read it again, until you do.}

\section{Now something More Complicated\label{tut-more-complicated}}
\section{Now something More Complicated - Authentication\label{tut-more-complicated}}

Now that you know how to write a primitive handler, let's try
something more complicated.
Expand Down Expand Up @@ -318,5 +318,112 @@ \section{Now something More Complicated\label{tut-more-complicated}}

\end{itemize}

\emph{XXX To be continued....}
\section{Publisher Handler Makes it Easy\label{tut-pub}}

At this point you may be wondering if mod_python is all that useful
after all. You may find yourself asking: "If there can only be one
handler per directory, how am I to structure my application?"

Enter the \code{publisher} handler provided as one of the standard
mod_python handlers. To get the publisher handler working,
you will need the following lines in your config:

\begin{verbatim}
AddHandler python-program .py
PythonHandler mod_python.publisher
\end{verbatim}

The following example will demonstrate a simple feedback form. The
form will ask for the name, e-mail address and a comment and the
will construct an e-mail to the webmaster using the information
submitted by the user.

Here is the html for the form:

\begin{verbatim}
<html>
Please provide feedback below:
<p>
<form action="form/email" method="POST">
Name: <input type="text" name="name"><br>
Email: <input type="text" name="email"><br>
Comment: <textarea name="comment" rows=4 cols=20></textarea><br>
<input type="submit">
</form>
</html>
\end{verbatim}

Note the \code{action} element of the \code{<form>} tag points to
\code{form/email}. We are going to create a file called \filenq{form.py},
like this:

\begin{verbatim}
import smtplib
def email(req, name, email, comment):
# see if the user provided all the parameters
if not (name and email and comment):
return "A required parameter is missing, \
please go back and correct the error"
# create the message text
msg = """\
From: %s
Subject: feedback
To: webmaster
I have the following comment:
%s
Thank You,
%s
""" % (email, comment, name)
# send it out
conn = smtplib.SMTP("localhost")
conn.sendmail(email, ["webmaster"], msg)
conn.quit()
# provide feedback to the user
s = """\
<html>
Dear %s,<br>
Thank You for your kind comments, we
will get back to you shortly.
</html>""" % name
return s
\end{verbatim}

When the user clicks the Submit button, the publisher handler will
load the \function{email} function in the \module{form} module,
passing it the form fields as keyword arguments. Note that it will
also pass the \class{Request} object as \code{req}. Note also that
you do not have to have \code{req} as one of the arguments if you do
not need it. The publisher handler is smart enough to pass your function
only those arguments that it will accept.

Also notice how it sends data back to the customer - via the return
value of the function.

And last, but not the least, note how all the power of mod_python
is still available to this function, since it has access to the
\class{Request} object. You can do all the same things you can do
with a "native" mod_python handler, e.g. set custom headers via
\code{req.headers_out}, return errors by raising
\exception{apache.SERVER_ERROR} exceptions, write or read directly
to and from the client via \method{req.write} and \method{req.read},
etc.

Read Section \ref{hand-pub} \citetitle[hand-pub.html]{Publisher Handler}
for more information on the publisher handler.
2 changes: 1 addition & 1 deletion Doc/modpython6.tex
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ \subsubsection{Traversal\label{hand-pub-alg-trav}}
an underscore (\samp{\_}). Use underscores to protect objects that should
not be accessible from the web.

If the an oject in the path could not be found, \constant{HTTP_NOT_FOUND}
If an oject in the path could not be found, \constant{HTTP_NOT_FOUND}
is returned to the client.

\subsubsection{Argument Matching and Invocation\label{hand-pub-alg-args}}
Expand Down
128 changes: 0 additions & 128 deletions doc/README.VMS

This file was deleted.

43 changes: 0 additions & 43 deletions doc/cgihandler.html

This file was deleted.

Loading

0 comments on commit 12f1fee

Please sign in to comment.