(self, sketch_id)
return jsonify(schema)
Handles GET request to the resource.

        Returns:
            Search history in JSON (instance of flask.wrappers.Response)
Handles GET request to the resource.
Handles GET request to the resource .
def get(self, sketch_id):
        """Handles GET request to the resource.

        Returns:
            Search history in JSON (instance of flask.wrappers.Response)
        """
        sketch = Sketch.query.get_with_acl(sketch_id)
        if not sketch:
            abort(HTTP_STATUS_CODE_NOT_FOUND, 'No sketch found with this ID.')

        tree = {}

        try:
            root_node = SearchHistory.query.filter_by(
                user=current_user, sketch=sketch).order_by(
                    SearchHistory.id.desc()).limit(
                        self.HISTORY_NODE_LIMIT)[-1]
        except IndexError:
            root_node = None

        last_node = SearchHistory.query.filter_by(
            user=current_user, sketch=sketch).order_by(
                SearchHistory.id.desc()).first()

        if root_node:
            tree = root_node.build_tree(root_node, {})

        schema = {
            'objects': [tree],
            'meta': {'last_node_id': last_node.id if last_node else None}
        }

        return jsonify(schema)
def get ( self , sketch_id ) : sketch = Sketch . query . get_with_acl ( sketch_id ) if not sketch : abort ( HTTP_STATUS_CODE_NOT_FOUND , 'No sketch found with this ID.' ) tree = { } try : root_node = SearchHistory . query . filter_by ( user = current_user , sketch = sketch ) . order_by ( SearchHistory . id . desc ( ) ) . limit ( self . HISTORY_NODE_LIMIT ) [ - 1 ] except IndexError : root_node = None last_node = SearchHistory . query . filter_by ( user = current_user , sketch = sketch ) . order_by ( SearchHistory . id . desc ( ) ) . first ( ) if root_node : tree = root_node . build_tree ( root_node , { } ) schema = { 'objects' : [ tree ] , 'meta' : { 'last_node_id' : last_node . id if last_node else None } } return jsonify ( schema )