def get(self): comments = Comments(postId=self.postId) comment = comments.get() if len(comment) > 0: for i, v in enumerate(comment): comment[i]['date'] = time.mktime(v['date'].timetuple())*1000 comment[i]['avatar'] = 'http://www.gravatar.com/avatar/' + hashlib.md5(v['email'].lower()).hexdigest() + '?s=40' return {'code': 200, 'data': comment} return {'code': 204, 'message': 'No commets'}