Created
June 11, 2012 11:29
-
-
Save moraes/2909661 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import webapp2 | |
from webapp2_extras import local | |
_local = local.Local() | |
# The deferred handler instantiates webapp2.WSGIApplication in the module | |
# globals, so when it is imported it ends resetting app globals. | |
# To avoid this we duplicate the globals part of the WSGIApplication here, | |
# knowing that only we will instantiate it. | |
class WSGIApplication(webapp2.WSGIApplication): | |
def set_globals(self, app=None, request=None): | |
_local.app = app | |
_local.request = request | |
def clear_globals(self): | |
_local.__release_local__() | |
def get_app(): | |
return _local.app | |
def get_request(): | |
return _local.request |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment