Created
July 26, 2013 17:47
-
-
Save mdippery/6090795 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
def ensure_subscription(fn): | |
@wraps(fn) | |
def _ensure_subscription(user, other, trade): | |
unsubscribe_code = user.profile.get_unsubscribe_code('trade-notifications') | |
if unsubscribe_code is None: | |
return | |
fn_globals = {} | |
fn_globals.update(globals()) | |
fn_globals['unsubscribe_code'] = unsubscribe_code | |
call_fn = FunctionType(fn.func_code, fn_globals) | |
return call_fn(user, other, trade) | |
return _ensure_subscription |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment