about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@hut.pm>2017-07-16 06:11:20 +0200
committerhut <hut@hut.pm>2017-07-16 06:11:20 +0200
commit064ac63da1acebd56e5bbf5ae7fe57fda8eb7bbc (patch)
treeb1f2d1865d579f860920e3c0dd02da372f44f396
parentfbf6d83a65317944f08e62e60e412bebe573c25d (diff)
downloadranger-064ac63da1acebd56e5bbf5ae7fe57fda8eb7bbc.tar.gz
ext.lazy_property: create XYZ__reset() as soon as possible
this allows using XYZ__reset from inside a lazy_property, for example to
bind the reset function to a signal.  See following commit
-rw-r--r--ranger/ext/lazy_property.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/ranger/ext/lazy_property.py b/ranger/ext/lazy_property.py
index c468a8c9..ccd1586e 100644
--- a/ranger/ext/lazy_property.py
+++ b/ranger/ext/lazy_property.py
@@ -50,9 +50,9 @@ class lazy_property(object):  # pylint: disable=invalid-name,too-few-public-meth
             setattr(obj, self.__name__, self)
             del obj.__dict__[self.__name__]  # force "__get__" being called
 
+        obj.__dict__[self.__name__ + "__reset"] = reset_function
         result = self._method(obj)
         obj.__dict__[self.__name__] = result
-        obj.__dict__[self.__name__ + "__reset"] = reset_function
         return result