Ticket #19872: cached_property.patch

File cached_property.patch, 510 bytes (added by Simon Percivall, 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):  
    3737    def __init__(self, func):
    3838        self.func = func
    3939
    40     def __get__(self, instance, type):
     40    def __get__(self, instance, type=None):
     41        if instance is None:
     42            return self
    4143        res = instance.__dict__[self.func.__name__] = self.func(instance)
    4244        return res
    4345
Back to Top