def _render(self, search_key):
        self.response.headers['content-type'] = 'application/json; charset="utf-8"'

        entry = TypeaheadEntry.get_by_id(search_key)
        if entry is None:
            return '[]'
        else:
            self._last_modified = entry.updated
            return entry.data_json
    def _render(self, search_key):
        self.response.headers['content-type'] = 'application/json; charset="utf-8"'

        entry = TypeaheadEntry.get_by_id(search_key)
        if entry is None:
            return '[]'
        else:
            self._last_modified = entry.updated
            return entry.data_json
 def _render(self, search_key):
     """
     Currently, search_key is the first character in the search query
     entered by the user. If desired, this could be the entire query, but
     searching by the first letter seems to be good enough for us.
     """
     entry = TypeaheadEntry.get_by_id(search_key)
     if entry is None:
         return '[]'
     else:
         return entry.data_json
    def _render(self, search_key):
        self.response.headers['Cache-Control'] = 'public, max-age=%d' % self._cache_expiration
        self.response.headers['Pragma'] = 'Public'
        self.response.headers['content-type'] = 'application/json; charset="utf-8"'

        entry = TypeaheadEntry.get_by_id(search_key)
        if entry is None:
            return '[]'
        else:
            if self._has_been_modified_since(entry.updated):
                return entry.data_json
            else:
                return None
    def _render(self, search_key):
        self.response.headers["Cache-Control"] = "public, max-age=%d" % self._cache_expiration
        self.response.headers["Pragma"] = "Public"
        self.response.headers["content-type"] = 'application/json; charset="utf-8"'

        entry = TypeaheadEntry.get_by_id(search_key)
        if entry is None:
            return "[]"
        else:
            if self._has_been_modified_since(entry.updated):
                return entry.data_json
            else:
                return None
Beispiel #6
0
    def _render(self, search_key):
        self.response.headers[
            'Cache-Control'] = 'public, max-age=%d' % self._cache_expiration
        self.response.headers['Pragma'] = 'Public'
        self.response.headers[
            'content-type'] = 'application/json; charset="utf-8"'

        entry = TypeaheadEntry.get_by_id(search_key)
        if entry is None:
            return '[]'
        else:
            if self._has_been_modified_since(entry.updated):
                return entry.data_json
            else:
                return None