1
0
mirror of https://github.com/avatao-content/baseimage-tutorial-framework synced 2025-04-07 11:22:39 +00:00

Avoid potential TypeErrors using LazyInitialise

This commit is contained in:
Kristóf Tóth 2018-06-02 11:25:48 +02:00
parent a743b01bcf
commit d5b0bb4d32

@ -13,7 +13,7 @@ class LazyInitialise:
def __get__(self, instance, owner):
if instance is None:
raise TypeError('Cannot get object property from class!')
return self # avoids potential __new__ TypeError
value = self.func(instance)
setattr(instance, self.func.__name__, value)
return value