Fix 'bl_app_override' wrapping multiple times.
authorCampbell Barton <ideasman42@gmail.com>
Wed, 29 Mar 2017 03:29:18 +0000 (14:29 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 29 Mar 2017 03:31:14 +0000 (14:31 +1100)
Calling `SomeClass.draw(self, context)` instead of `self.draw()`
would try to wrap the argument `self` multiple times, causing an error.

release/scripts/modules/bl_app_override/__init__.py

index 66857701669e0e74d624f171ad28bba9f55e6669..89cc8a0eb28c3c23a0b925bf736b3691a490964d 100644 (file)
@@ -147,10 +147,12 @@ def ui_draw_filter_register(
             return super().operator(*args, **kw)
 
     def draw_override(func_orig, self_real, context):
-        # simple, no wrapping
-        # return func_orig(self_wrap, context)
+        cls_real = self_real.__class__
+        if cls_real is super:
+            # simple, no wrapping
+            return func_orig(self_real, context)
 
-        class Wrapper(self_real.__class__):
+        class Wrapper(cls_real):
             __slots__ = ()
             def __getattribute__(self, attr):
                 if attr == "layout":