Created
December 12, 2010 09:19
-
-
Save jeremi/737950 to your computer and use it in GitHub Desktop.
This decorator restore the original namespace after the function has been executed in appengine.
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
def restore_namespace_after(func): | |
"""Decorator that ensures that restore the original namespace after the function has | |
been executed in appengine.""" | |
@functools.wraps(func) | |
def decorated_func(*args, **kwargs): | |
namespace = namespace_manager.get_namespace() | |
res = func(*args, **kwargs) | |
namespace_manager.set_namespace(namespace) | |
return res | |
return decorated_func |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment