fixing cached property
This commit is contained in:
parent
cb0f20f2c0
commit
4d116ed5dc
2 changed files with 5 additions and 6 deletions
|
@ -5,6 +5,7 @@ from bleach import clean
|
||||||
import arrow
|
import arrow
|
||||||
import keys
|
import keys
|
||||||
import common
|
import common
|
||||||
|
from common import cached_property
|
||||||
import settings
|
import settings
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
import logging
|
import logging
|
||||||
|
@ -67,15 +68,13 @@ class FlickrFav(common.ImgFav):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "fav-of %s" % (self.url)
|
return "fav-of %s" % (self.url)
|
||||||
|
|
||||||
@property
|
@cached_property
|
||||||
@common.cached_property
|
|
||||||
def owner(self):
|
def owner(self):
|
||||||
return self.info.get('owner')
|
return self.info.get('owner')
|
||||||
|
|
||||||
@property
|
@cached_property
|
||||||
@common.cached_property
|
|
||||||
def info(self):
|
def info(self):
|
||||||
return flickrphoto.getInfo()
|
return self.flickrphoto.getInfo()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def author(self):
|
def author(self):
|
||||||
|
|
|
@ -30,6 +30,7 @@ class cached_property(object):
|
||||||
def __init__(self, method, name=None):
|
def __init__(self, method, name=None):
|
||||||
self.method = method
|
self.method = method
|
||||||
self.name = name or method.__name__
|
self.name = name or method.__name__
|
||||||
|
|
||||||
def __get__(self, inst, cls):
|
def __get__(self, inst, cls):
|
||||||
if inst is None:
|
if inst is None:
|
||||||
return self
|
return self
|
||||||
|
@ -37,7 +38,6 @@ class cached_property(object):
|
||||||
setattr(inst, self.name, result)
|
setattr(inst, self.name, result)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
class Follows(object):
|
class Follows(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.feeds = {}
|
self.feeds = {}
|
||||||
|
|
Loading…
Reference in a new issue