Homework Questions
Due: September 28, 2010
- What services compose a typical wiki?
[For bonus points, what functionality would each of these services provide?]
-
What does this response header mean?
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Explain in words.
(No we didn't cover this in class, that's why there's the internet.)
See
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
-
What is HTTP code 418? How did it come about?
Due: October 12, 2010
-
Take helloworld.py and add the line
import pdb; pdb.set_trace() before you return the response.
Now run the application and hit it with a web browser (should
be at http://127.0.0.1:8080 as paste will tell you).
You request will stall when you hit your pdb statement.
- what headers is your browser sending? (look at
request.headers)
-
now change this into a simple web service that will return a
text/plain response of the names of the headers
and their values
-
Look at the code for
paste.wsgilib.dump_environ. Get it running in a WSGI server.
What does it do? How would you write this with webob?
-
Compare a web framework from
http://k0s.org/mozilla/craft/python.html#frameworks-vs-services
with one or more other python web frameworks there or elsewhere
on the web.
When would you want to use one? When would you want to use another?
What are the advantages and disadvantages of each?
- Draw a diagram of webob_view. Don't feel confined to use any
particular format, just explain what it is/does with a picture.
Points for creativity.
- How does webob_view work? Explain with words.
Unassigned:
- Let's say you were developing a service that would
take pictures of words and try to translate them to text.
You are given an input, the parts of the word that are guessed.
For instance: you have the string ex??pl? for
"example".
-
What would your function look like in terms of input and output
(what it would get and what it would return). In python, please.
-
What data would you need available to be able to write such a
function? What other data would be useful?
-
Assuming you have available whatever data you choose,
write a function that guesses (or, better, computes
various probabilities) given a single-word string with unknown
values, as above. [Yes, this is a hard problem.
The exercise is more pointed to, what approximations can
you make so that you can solve it!]
-
Assuming you had such a service working reliably, what
"practical" problems could you put it to?
- Compare the genshi templating system with one or more other
XML/HTML templating systems. Which one do you like best? Why?
- What is "wrong" with the commenting middleware from
http://pythonpaste.org/webob/comment-example.html?
How could it be improved?
- Describe the architecture of clwapp. What security concerns
are there when deploying it?