def render_api(cls, api_request): """renders cahoots response in json""" query = api_request.form.get('snippet', '') results = None if query != '': results = PARSER.parse(query) return out.encode(results)
def render_home(self, web_request): """renders web interface""" query = web_request.form.get('snippet', '') results = None if query != '': results = PARSER.parse(query) return self.render( 'home.html', q=query, results=results, json_results=out.encode(results) )