Day 5: Tuesday, January 21st, 2014ΒΆ

  1. For class, read:

  2. Quiz and discussion.

  3. Roadmap for next few weeks.

    Week 4: forms - submitting basic user input data to the web server; HTML.

    Week 5: WSGI - building a fully functional Web server component; templating.

    Week 6: More interesting Web apps; header processing & cookies.

  4. Structure of HTTP, revisited. See presentation.

    Payload of request, abstractly

    Payload of response, abstractly

  5. String whacking.

    Read Strings and Lists and try to solve these problems generically, using only those string manipulation commands:

    1. Pick out the 3rd value, e.g.

      f("a,b,c,d,e,f") == "c"
    2. Extract everything after the 4th comma in a string, e.g.

      f("a,b,c,d,e,f,g") == "e,f,g"
    3. Return the fourth and fifth lines of a multiline string, e.g.

      f("a\nb\nc\nd\ne\nf\n") = ["d", "e"]
    4. Pick out the third and fourth values, removing leading underscores, e.g.:

      f("_a,_b,_c,_d,_e,_f") = ["d", "e"]

    See also String Methods, and Strings: Part I, Part II, and Part III.

  1. Testing.

    Create a new directory & download two files to arctic by doing:

    mkdir cse491-day5
    cd cse491-day5

    Activate your virtualenv:

    source ~/cse491.env/bin/activate.csh

    and then run nosetests:


    You should see 8 errors from the code in ‘’. Fix the code in ‘’ so that the tests all pass!

    Solutions here:

Previous topic

Day 6: Thursday, January 23rd, 2014

Next topic

Homework 2

This Page

Edit this document!

This file can be edited directly through the Web. Anyone can update and fix errors in this document with few clicks -- no downloads needed.

  1. Go to Day 5: Tuesday, January 21st, 2014 on GitHub.
  2. Edit files using GitHub's text editor in your web browser (see the 'Edit' tab on the top right of the file)
  3. Fill in the Commit message text box at the bottom of the page describing why you made the changes. Press the Propose file change button next to it when done.
  4. Then click Send a pull request.
  5. Your changes are now queued for review under the project's Pull requests tab on GitHub!

For an introduction to the documentation format please see the reST primer.