added logic for USER_REQUIRE_INVITATION

When `USER_REQUIRE_INVITATION` flag is set, if the user navigates to `/user/register` they will be thrown back to `/user/login` if an `invite_token` is not present as a request variable.

I also fixed some weird python 3.4 issues for py.test