def atualizar(self): key = cgi.escape(self.request.get('key')) friend = Amigo.get(key) self.save(friend) self.list('Amigo %s editado com sucesso!' % friend.login)
def get(self): try: key = cgi.escape(self.request.get('key')) friend = Amigo.get(key) self.render('friend/friend.html', { 'friend': friend, 'groups': self.get_groups() }) except tweepy.TweepError, e: # Failed to get a request token self.render_error({'message': e}) return
def list(self, message=''): try: friends = set() for friend in Amigo.all(): friends.add(friend) self.render('friend/list.html', { 'friends': friends, 'message': message }) except tweepy.TweepError, e: # Failed to get a request token self.render_error({'message': e})
def adicionar(self): friend = Amigo() friend.login = cgi.escape(self.request.get('login')) self.save(friend) self.list('Amigo %s adicionado com sucesso!' % friend.login)
def get_amigo(self): key = cgi.escape(self.request.get('key')) return Amigo.get(key)