Fix bug handling exceptions in RevisionMiddleware

Recently the RevisionMiddleware was modified to avoid accessing
request.user unncessarily for caching purposes.  This works well
except in some cases it can obscure errors generated elsewhere in a
project.

The RevisionContextManager has "active" and "inactive" states.
If there is an exception handler elsewhere in the middleware stack
that generates a new HTTP response, the
RevisionMiddleware.process_exception() method will inactivate the
RevisionContextManager via _close_revision().  Then the HTTP response will
be provided to process_response().  If a user is logged in the middleware
will call RevisionContextManager.set_user(), which expects to be in the
active state, and throws an error ("no active revision for this thread").

To fix this, check if the RevisionContextManager is in the active state
before calling set_user.
Merge pull request #256 from pricem/middleware-exception

Fix bug in RevisionMiddleware exception handling