mirror of
				https://github.com/avatao-content/baseimage-tutorial-framework
				synced 2025-11-04 12:42:55 +00:00 
			
		
		
		
	Avoid potential TypeErrors using LazyInitialise
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user