Ticket #19872: cached_property.patch
File cached_property.patch, 510 bytes (added by , 12 years ago) |
---|
-
django/utils/functional.py
diff --git a/django/utils/functional.py b/django/utils/functional.py index befe3e9..aafe9aa 100644
a b class cached_property(object): 37 37 def __init__(self, func): 38 38 self.func = func 39 39 40 def __get__(self, instance, type): 40 def __get__(self, instance, type=None): 41 if instance is None: 42 return self 41 43 res = instance.__dict__[self.func.__name__] = self.func(instance) 42 44 return res 43 45