summaryrefslogtreecommitdiff
path: root/docs/users_guide_2_src/unused.txt
blob: 3b78fc998056e8aaaeb2fabf235719d23cbd0ea3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Give me an example of a Webware servlet!}
\label{intro.example.servlet}

This example uses an HTML form to ask the user's name, then invokes itself
again to display a {\em personalized} friendly greeting.  

\begin{verbatim}
<HTML><HEAD><TITLE>My Template-Servlet</TITLE></HEAD><BODY>   
#set $name = $request.field('name', None)
#if $name  
Hello $name
#else
<FORM ACTION="" METHOD="GET">
Name: <INPUT TYPE="text" NAME="name"><BR>
<INPUT TYPE="submit">
</FORM>
#end if
</BODY></HTML>
\end{verbatim}

To try it out for yourself on a Webware system:
\begin{enumerate}
\item copy the template definition to a file {\bf test.tmpl} in your
    Webware servlet directory.
\item Run ``\code{cheetah compile test.tmpl}''.  This produces
    {\bf test.py} (a .py template module) in the same directory.
\item In your web browser, go to {\bf test.py}, using whatever site and
    directory is appropriate.  Depending on your Webware configuration, you may
    also be able to go to {\bf test}.
\end{enumerate}

At the first request, field `name' will be blank (false) so the ``\#else''
portion will execute and present a form.  You type your name and press submit.
The form invokes the same page.  Now `name' is true so the ``\#if'' portion
executes, which displays the greeting.  The ``\#set'' directive creates a
local variable that lasts while the template is being filled.



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
To install Cheetah in your system-wide Python library:
* Login as a user with privileges to install system-wide Python packages.
  On POSIX systems (AIX, Solaris, Linux, IRIX, etc.), the command is

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Certain test failures are insignificant:
\begin{description}
\item{**AssertionError: Template output mismatch: Expected Output = 0(end)
Actual Output = False(end)**}  Python 2.3 changed the string representation of
booleans, and the tests haven't yet been updated to reflect this.  
\item{**AssertionError: subcommand exit status 127**}  Certain tests run
"cheetah" as a subcommand.  The failure may mean the command wasn't found
in your system path. (What happens if you run "cheetah" on the command line?)
The failure also happens on some Windows systems for unknown reasons.  This
failure has never been observed outside the test suite.  Long term, we plan to
rewrite the tests to do a function call rather than a subcommand, which will
also make the tests run significantly faster.
\item{**ImportError: No module named SampleBaseClass**}  The test tried to
write a temporary module in the current directory and ``import`` it.  Reread
the first paragraph in this section about the current directory.
\item{**ImportError: No module named tmp**}  May be the same problem as
SampleBaseClass; let us know if changing the current directory doesn't work.
\end{description}

  normally 'su root'.  On non-POSIX systems such as Windows NT, login as an
  administrator.