SI 539 Assignment 05
Using the webapp framework
Due Date: Friday October 21, 2011 - 11:55 PM
In this assignment, you will re-implement the number guessing program from the
previous assignment using the webapp framework from Chapter 5.
- In response to all requests (GET or POST), your webapp should display a title at the
top of the page saying "Chuck's New and Improved Number Guessing Game", except
you will substitute your own name for "Chuck".
- For an HTTP GET request, your webapp should display a message under the title
saying "Please enter your guess.".
- For an HTTP POST request, if the input is a valid integer, your webapp should
display the user's guess below the title as in the previous assignment
(e.g. "You guessed 95" or "Your guess was 95") followed by a
message giving the user a hint about their guess in the same manner as
in the previous assignment.
- For an HTTP POST request, if the input is not a valid integer,
your webapp should display
a message below the title saying, "Please enter a valid numeric guess".
- In response to all requests (GET or POST), your webapp should display the form
below the title and messages, as in the previous assignment.
- For each POST request, write a message to the log showing the raw guess before
it is converted to a number.
The message should look like this:
Raw guess=25
entered invalid input or that the user entered a valid numeric guess and include the
user's guess in the log message. Use "logging.info()" for your log message.
- Your program must use the webapp framework.
Your program must not use sys.stdin.read() or print.
All input from the user should be handled
with self.request.get() and all output to the user should be handled with
self.response.out.write().
What to hand in
You should hand in the folowing to CTools.
- Three screen shots of your version of the webapp running in a browser:
- One showing your program's response to a GET request as it appears in the
browser.
- One showing your program's response to a POST request with a non-numeric
guess.
- One showing your program's response to a POST request with a guess that is
too high.
- A screenshot of the log showing log messages from your index.py program.
This screen shot should include at least one of the log messages you added to the
program.
- A ZIP file containing the entire folder containing the source code of your
application folder, including the "app.yaml" file
and the "index.py" files inside the folder.