Massively refactor the document() view.

This splits up the original monolithic document() view into quite a
few pieces. Many operations have been pulled out into standalone
utility functions, for ease of future maintenance and tracing the
control flow. Additionally, two of the original exit points (showing
deletion logs for a deleted Document, and showing a raw Document) have
been spun out into views of their own.

Along the way, some code has been cleaned up or tightened for better
Pythonic style, and the "set_common_headers" closure has been promoted
into its own standalone function, albeit with a different signature
than the original (the ability to pass in a set of response headers
and have them preserved was never actually used).
Issue #2062: Bugfix for case-flexibility in real world links
Merge pull request #2074 from lmorchard/linkannotation-queries

Issue #2062: Bugfix for case-flexibility in real world links
Update django-recaptcha to latest version to remove artificial dependency on django-registration.

See https://github.com/praekelt/django-recaptcha/commit/18812b92b041bcd289be658feb29d9ac8aa52f96
Use wheelball for vagrant setup and switch to Python2.6.
Install Django from PyPI because 1.4.x can't be installed flawlessly via a wheel file.
Fix jingo error.
Added apt cache.
Fixed SyntaxError in test.
Use secure URL for Vagrant box.
Added invoke task to build wheelball of the compiled requirements for travis.
Trying using aria2 instead.
Because I can't read manpages.
Create a non-root virtualenv.
Create the cache dir correctly.
Make sure the order of directory creation is correct.
additional tweaks
Merge pull request #2045 from darkwing/404matting

Format crazy eye blocks
Merge pull request #2041 from jezdez/patch-wheels

Updated Vagrant setup to use wheelball.
Merge pull request #2076 from groovecoder/document-view-refactor

Document view refactor