Get all tests passing on Windows. Only a few main code changes.

This series of commits have been tested on Windows 7 and Ubuntu 12.04, both equipped with Python 2.7.3. All tests are now passing. There are only a few non-obvious changes. Feel free to comment if something isn't readily apparent from the code.

Thanks for pelican!