Having object.property be something different every time it's evaluated makes things kind of weird.
From: David Shea dshea@redhat.com
Having object.property be something different every time it's evaluated makes things kind of weird. --- pyanaconda/ui/gui/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/ui/gui/utils.py b/pyanaconda/ui/gui/utils.py index 676416f..9166606 100644 --- a/pyanaconda/ui/gui/utils.py +++ b/pyanaconda/ui/gui/utils.py @@ -255,6 +255,8 @@ def __init__(self, func): self._last_start = None self._timer_id = None
+ self._instance_map = {} + @property def timer_active(self): """Whether there is a pending timer for this action.""" @@ -312,7 +314,10 @@ def __call__(self, *args, **kwargs): # instance of whatever is being decorated by returning a curried version # of ourself with the instance applied as the first argument. def __get__(self, instance, owner): - return functools.partial(self, instance) + if instance not in self._instance_map: + self._instance_map[instance] = functools.partial(self, instance) + + return self._instance_map[instance]
# Return TimedAction as the decorator function. The constructor will be # called with the function to be decorated as the argument, returning a
Looks ok for me
Added label: ACK.
Looks good to me too.
Closed.
Pushed.
anaconda-patches@lists.fedorahosted.org