Permalink
Browse files

Minor fix to handle the rare case where memcache expired one of the i…

…mage properties and not the other.

git-svn-id: https://robohornet.googlecode.com/svn/trunk@150 48a18672-c925-a5f9-4b90-b3a8688770c7
  • Loading branch information...
1 parent 811c4de commit 7160628c6d1a575c738318112e015e21894af19c komoroske@google.com committed May 7, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 voting.py
View
@@ -120,12 +120,12 @@ class Issue(db.Model):
number = db.IntegerProperty(required=True)
vote_count = db.IntegerProperty(default = 0)
def get_image(self):
- #TODO: support mulptiple badge sizes
+ #TODO: support multiple badge sizes
memcache_key = "issue_%d_image" % self.number
cached_values = memcache.get_multi([memcache_key, memcache_key + "_width"])
image_data = cached_values.get(memcache_key)
width = cached_values.get(memcache_key + "_width")
- if image_data:
+ if image_data and width:
im = Image.fromstring("RGBA", (width, BADGE_HEIGHT), image_data)
else:
im, width = draw_image(self.number, self.vote_count)

0 comments on commit 7160628

Please sign in to comment.