def get(self):
     if(self.request.get('request_suggestion')):
         self.response.write(json.dumps(search_suggestion(self.request.get('query_key'), 20)))
         return
     template_dict = urls.getUrlDir()
     key_word = self.request.get('key_word')
     if key_word:
         offset = self.request.get('offset')
         if offset:
             offset = int(offset)
         else:
             offset = 0
         template_dict['key_word'] = key_word
         template_dict['streams'] = search_streams(key_word)
         template_dict['offset'] = offset
         template_dict['num_results_per_page'] = num_results_per_page
         template_dict['num_pages_displayed'] = num_pages_displayed
         self.response.write(urls.getTemplate(template_name).render(template_dict))
     else:
         self.error(400)
         jumpToErrorPage(self, 'No search key found!')
 def get(self):
     if (self.request.get('request_suggestion')):
         self.response.write(
             json.dumps(search_suggestion(self.request.get('query_key'),
                                          20)))
         return
     template_dict = urls.getUrlDir()
     key_word = self.request.get('key_word')
     if key_word:
         offset = self.request.get('offset')
         if offset:
             offset = int(offset)
         else:
             offset = 0
         template_dict['key_word'] = key_word
         template_dict['streams'] = search_streams(key_word)
         template_dict['offset'] = offset
         template_dict['num_results_per_page'] = num_results_per_page
         template_dict['num_pages_displayed'] = num_pages_displayed
         self.response.write(
             urls.getTemplate(template_name).render(template_dict))
     else:
         self.error(400)
         jumpToErrorPage(self, 'No search key found!')
示例#3
0
 def getSearchSuggestion(self, request):
     return RespondSearchSuggestions(suggestions=[suggestion for suggestion in search_suggestion(request.key_word, 20)])