Fix pathinfohack for nginx+uwsgi

This results in a "hack" that is actually more robust.

And now with tests. The previous logic relied on PATH_INFO
and SCRIPT_NAME always being set, which is not always the
case with all servers.

Unfortunately nginx follows convention and decodes pathinfo.

sigh, who started this bogus crap?
pep8, pylint, etc

Mostly adding docs and general tidy.
release 1.0.0