示例#1
0
    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)
示例#2
0
    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)
        )