Created
November 19, 2013 20:37
-
-
Save ianjosephwilson/7552112 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class TrytonServerWrapper(object): | |
def __init__(self, user_id, session_id, context, target): | |
self.user_id = user_id | |
self.session_id = session_id | |
self.context = context | |
self.target = target | |
def __call__(self, *args): | |
new_args = [self.user_id, self.session_id] | |
new_args.extend(args) | |
new_args.append(self.context) | |
return self.target.__call__(*new_args) | |
def __getattribute__(self, name): | |
if name in ('user_id', 'session_id', 'context', 'target'): | |
return object.__getattribute__(self, name) | |
return TrytonServerWrapper(self.user_id, self.session_id, self.context, | |
getattr(self.target, name)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment