All PEP8 fixes. Some simple refactoring work.

I got rid of the test setup in the server as I am about to move
to Karma as that is the test tool used by the AngularJS team.
Added hashing of files for appcache

Also some more refactoring server side.