Day 16: Thursday, Feb 27th, 2014ΒΆ

  1. Lecture notes

  2. Walk through solution for Homework 7, problem 3. (How are images served?)

  3. Form submission and redirects:

    See https://github.com/ctb/cse491-serverz/blob/day16/imageapp/root.py, functions ‘upload’ and ‘upload2’.

  4. Read through the examples in JavaScript and JQuery and integrate one JavaScript and one JQuery example each into one or more of your pages from HW 7. (Don’t worry too much about which page, and no, they don’t have to be on any specific page.) You should be editing your templates files to do this.

Note: you can either pull these files into your hw7 branch by doing

git pull https://github.com/ctb/cse491-serverz.git day16

or by doing a clean checkout in some other directory and then copying over the ones you care about:

git clone https://github.com/ctb/cse491-serverz.git day16 -b day16

or you can just download and save the example files through github. Whatever suits.

Also note: if you’re having trouble loading the jquery-1.3.2.min.js file through your server, you can use this code snippet in your RootDirectory class (in imageapp/root.py):

# make sure to import:
#    from quixote.util import StaticFile
#    import os.path

# 'filename' must be in the _q_exports list
_q_exports = [ ..., 'filename', ...]

filename = StaticFile(os.path.abspath("./filename.txt"))

Here, ‘filename.txt’ will be served from whatever directory you’re running your WSGI server from.

Previous topic

Day 17: Tuesday, Mar 11th, 2014

Next topic

Day 15: Tuesday, Feb 25th, 2014

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 16: Thursday, Feb 27th, 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.