(self, sketch_id, view_id)
return self.to_json(view)
Handles GET request to the resource.

        Args:
            sketch_id: Integer primary key for a sketch database model
            view_id: Integer primary key for a view database model

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

        Args:
            sketch_id: Integer primary key for a sketch database model
            view_id: Integer primary key for a view database model

        Returns:
            A view 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.')
        view = View.query.get(view_id)

        if not sketch.has_permission(current_user, 'read'):
            abort(HTTP_STATUS_CODE_FORBIDDEN,
                  'User does not have read access controls on sketch.')

        # Check that this view belongs to the sketch
        if view.sketch_id != sketch.id:
            abort(
                HTTP_STATUS_CODE_NOT_FOUND,
                'Sketch ID ({0:d}) does not match with the sketch ID '
                'that is defined in the view ({1:d})'.format(
                    view.sketch_id, sketch.id))

        # If this is a user state view, check that it
        # belongs to the current_user
        if view.name == '' and view.user != current_user:
            abort(
                HTTP_STATUS_CODE_FORBIDDEN,
                'Unable to view a state view that belongs to a '
                'different user.')

        # Check if view has been deleted
        if view.get_status.status == 'deleted':
            meta = dict(deleted=True, name=view.name)
            schema = dict(meta=meta, objects=[])
            return jsonify(schema)

        # Make sure we have all expected attributes in the query filter.
        view.query_filter = view.validate_filter()
        db_session.add(view)
        db_session.commit()

        return self.to_json(view)
def get ( self , sketch_id , view_id ) : sketch = Sketch . query . get_with_acl ( sketch_id ) if not sketch : abort ( HTTP_STATUS_CODE_NOT_FOUND , 'No sketch found with this ID.' ) view = View . query . get ( view_id ) if not sketch . has_permission ( current_user , 'read' ) : abort ( HTTP_STATUS_CODE_FORBIDDEN , 'User does not have read access controls on sketch.' ) # Check that this view belongs to the sketch if view . sketch_id != sketch . id : abort ( HTTP_STATUS_CODE_NOT_FOUND , 'Sketch ID ({0:d}) does not match with the sketch ID ' 'that is defined in the view ({1:d})' . format ( view . sketch_id , sketch . id ) ) # If this is a user state view, check that it # belongs to the current_user if view . name == '' and view . user != current_user : abort ( HTTP_STATUS_CODE_FORBIDDEN , 'Unable to view a state view that belongs to a ' 'different user.' ) # Check if view has been deleted if view . get_status . status == 'deleted' : meta = dict ( deleted = True , name = view . name ) schema = dict ( meta = meta , objects = [ ] ) return jsonify ( schema ) # Make sure we have all expected attributes in the query filter. view . query_filter = view . validate_filter ( ) db_session . add ( view ) db_session . commit ( ) return self . to_json ( view )