From 4d116ed5dcae24f7f3d54253a540185dfedf22c9 Mon Sep 17 00:00:00 2001 From: Peter Molnar Date: Sat, 3 Nov 2018 10:49:45 +0100 Subject: [PATCH] fixing cached property --- Flickr.py | 9 ++++----- common.py | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Flickr.py b/Flickr.py index be6ece7..e2ab149 100644 --- a/Flickr.py +++ b/Flickr.py @@ -5,6 +5,7 @@ from bleach import clean import arrow import keys import common +from common import cached_property import settings from pprint import pprint import logging @@ -67,15 +68,13 @@ class FlickrFav(common.ImgFav): def __str__(self): return "fav-of %s" % (self.url) - @property - @common.cached_property + @cached_property def owner(self): return self.info.get('owner') - @property - @common.cached_property + @cached_property def info(self): - return flickrphoto.getInfo() + return self.flickrphoto.getInfo() @property def author(self): diff --git a/common.py b/common.py index 4b099ea..6685ff8 100644 --- a/common.py +++ b/common.py @@ -30,6 +30,7 @@ class cached_property(object): def __init__(self, method, name=None): self.method = method self.name = name or method.__name__ + def __get__(self, inst, cls): if inst is None: return self @@ -37,7 +38,6 @@ class cached_property(object): setattr(inst, self.name, result) return result - class Follows(object): def __init__(self): self.feeds = {}