Small tweaks to virtualenv script
Merge pull request #726 from learning-unlimited/lua-virtualenv-tweaks

Small tweaks to virtualenv script
Fix typo in virtualenv script

...that caused lines 17-27 of the script to be a no-op. Oops.
Merge pull request #735 from learning-unlimited/lua-virtualenv-fix

Fix typo in virtualenv script
Quote things in make_virtualenv.sh to make it safer
Quote "virtualenv>=1.10" so that it's not interpreted as a shell redirect
Add script to update apt and pip dependencies
Bump Django to 1.4.8
Fixes proxy caching bug with debug toolbar

request.user.isAdmin() was being called on every request, setting
Vary:Cookie and preventing proxy caching.

Resolves Github issue #739 by changing the conditions for which the
debug toolbar is displayed, and reordering them to take advantage of
short-circuiting to only call request.user.isAdmin() when necessary.
Replace end_date references in queries for ExpirableModels

We had several StudentRegistration queries that expected valid
registrations to have an end date far in the future (e.g. 1/1/9999). Now
that StudentRegistration subclasses ExpirableModel, the currently open
registrations have an end date of None.  This is reflected in the static
methods ExpirableModel.valid_objects() and is_valid_qobject() that
StudentRegistration inherits.

This change updates all queries of StudentRegistration objects that tried
to filter on the end date (e.g. end_date__gte=datetime.now()) to use the
ExpirableModel static methods instead.  The nest_Q function comes in very
handy here.
Fix import mistakes in users __init__.py
Merge pull request #740 from learning-unlimited/debug-toolbar-fix

Fixes proxy caching bug with debug toolbar
Fold Q objects into same filter() expression

This avoids the potential for different-than-expected query results due to
having named query options in one .filter() statement and the
StudentRegistration related Q object in a second .filter().
Fix chained .filter() on Permission.program_by_perm()
Merge pull request #737 from learning-unlimited/bump-django-1.4.8

Bump Django to 1.4.8
Merge pull request #725 from learning-unlimited/django-reversion-bump

Depend on latest django-reversion for proxy caching fix
Merge pull request #736 from learning-unlimited/lua-more-virtualenv

Add script to update apt and pip dependencies
Fixes PIL dependency

Teachers without biography photos were generating 500 errors on their
biography pages. This was happening with the assignment
teacherbio.picture = 'images/not-available.jpg'.
PIL was throwing the exception "decoder jpeg not available".

libjpeg-dev is a dependency for PIL jpeg decoder support. See
<http://stackoverflow.com/questions/8915296/decoder-jpeg-not-available-pil>.
This is now added as a dependency.

The bug remained after making this change. Further investigation revealed that
PIL does not easily support virtualenv. It looks for the jpeg decoder files in
a fixed directory; see
<http://stackoverflow.com/questions/11692111/getting-django-to-recognize-pil-jpeg-support>
and <http://stackoverflow.com/a/13053041>.

PIL has not been updated since 2009, and it is unlikely that virtualenv
support will be added. However, the Pillow package, a fork of PIL, does
support virtualenv, and is under active development. See
<http://stackoverflow.com/a/7611630> and <https://pypi.python.org/pypi/Pillow/2.2.1>.

This commit changes the dependency on PIL to a dependency on Pillow. After
uninstalling PIL and installing Pillow, the bug is fixed. However, manage.py
validate will complain about the lack of PIL.

If PIL is already installed in the virtualenv, the following commands must be
run to uninstall PIL:
$ source env/bin/activate
$ pip uninstall PIL
Add 'now' argument to valid_objects()

Fixes a bug involving different lines of code using different values
of "now" in close proximity.
Fix name error in ClassSubject.is_nearly_full()