diff options
Diffstat (limited to 'lib/git/method_missing.py')
-rw-r--r-- | lib/git/method_missing.py | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/git/method_missing.py b/lib/git/method_missing.py index 478ee1d3..06414cc4 100644 --- a/lib/git/method_missing.py +++ b/lib/git/method_missing.py @@ -4,17 +4,14 @@ class MethodMissingMixin(object): This was `taken from a blog post <http://blog.iffy.us/?p=43>`_ """ - def __getattribute__(self, attr): - try: - return object.__getattribute__(self, attr) - except: - class MethodMissing(object): - def __init__(self, wrapped, method): - self.__wrapped__ = wrapped - self.__method__ = method - def __call__(self, *args, **kwargs): - return self.__wrapped__.method_missing(self.__method__, *args, **kwargs) - return MethodMissing(self, attr) + def __getattr__(self, attr): + class MethodMissing(object): + def __init__(self, wrapped, method): + self.__wrapped__ = wrapped + self.__method__ = method + def __call__(self, *args, **kwargs): + return self.__wrapped__.method_missing(self.__method__, *args, **kwargs) + return MethodMissing(self, attr) def method_missing(self, *args, **kwargs): """ This method should be overridden in the derived class. """ |