From ffc0343efb1ad2fbb877451a19a4d29fe56f547b Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sun, 9 Oct 2011 10:17:49 +0200 Subject: [PATCH] [sulfur.views] fix get_stars_rating caching, was causing rendering problems with installed packages icons --- sulfur/src/sulfur/views.py | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/sulfur/src/sulfur/views.py b/sulfur/src/sulfur/views.py index 33a630315..7c2286fd7 100644 --- a/sulfur/src/sulfur/views.py +++ b/sulfur/src/sulfur/views.py @@ -1964,29 +1964,24 @@ class EntropyPackageView: if not pkg: return - last_pkg = getattr(self, "_last_get_stars_rating", None) - if last_pkg is pkg: - return + self.set_line_status(pkg, cell) + try: + voted = pkg.voted + except: + voted = False try: - self.set_line_status(pkg, cell) - try: - voted = pkg.voted - except: - return - try: - # vote_delayed loads the vote in parallel and until - # it's not ready returns None - mydata = pkg.vote_delayed - except: - return - if mydata is None: - mydata = 0.0 # wtf! + # vote_delayed loads the vote in parallel and until + # it's not ready returns None + mydata = pkg.vote_delayed + except: + mydata = None - cell.value = float(mydata) - cell.value_voted = float(voted) - finally: - self._last_get_stars_rating = pkg + if mydata is None: + mydata = 0.0 # wtf! + + cell.value = float(mydata) + cell.value_voted = float(voted) def spawn_vote_submit(self, obj):