Permalink
Browse files

Avatar logic enhanced.

  • Loading branch information...
1 parent e4a9d3d commit 1843ab23c14411dcd21ac9937a8f71d1451b2c4f @livid committed Oct 11, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 avatar.py
View
@@ -14,18 +14,18 @@
class AvatarHandler(webapp.RequestHandler):
def get(self, member_num, size):
avatar = GetKindByName('Avatar', 'avatar_' + str(member_num) + '_' + str(size))
- if avatar is not None:
+ if avatar:
self.response.headers['Content-Type'] = "image/png"
self.response.headers['Cache-Control'] = "max-age=172800, public, must-revalidate"
self.response.headers['Expires'] = "Sun, 25 Apr 2011 20:00:00 GMT"
self.response.out.write(avatar.content)
else:
- self.error(404)
+ self.redirect('/static/img/avatar_' + str(size) + '.png')
class NodeAvatarHandler(webapp.RequestHandler):
def get(self, node_num, size):
avatar = GetKindByName('Avatar', 'node_' + str(node_num) + '_' + str(size))
- if avatar is not None:
+ if avatar:
self.response.headers['Content-Type'] = "image/png"
self.response.headers['Cache-Control'] = "max-age=172800, public, must-revalidate"
self.response.headers['Expires'] = "Sun, 25 Apr 2011 20:00:00 GMT"

0 comments on commit 1843ab2

Please sign in to comment.