def index(self): word = self.params.get('word') if not word: raise "no word!" user = get_user_or_letlogin(self,'/search/?word=%s' % word) log = SearchLog(word=word, user=user) log.put() voca = Vocabulary(key_name=user.email+'_'+word, word=word, user=user) voca.put() query_url = YahooDictionary.get_search_url(word) self.redirect(query_url)
def home(self): self.user = get_user_or_letlogin(self, '/user/home') self.vocabularies = Vocabulary.gql("WHERE user=:1", self.user).fetch(200)