(self, sketch_id, story_id)
return self.to_json(story, meta=meta)
Handles GET request to the resource.

        Args:
            sketch_id: Integer primary key for a sketch database model
            story_id: Integer primary key for a story database model

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

        Args:
            sketch_id: Integer primary key for a sketch database model
            story_id: Integer primary key for a story database model

        Returns:
            A story in JSON (instance of flask.wrappers.Response)
        """
        sketch = Sketch.query.get_with_acl(sketch_id)
        story = Story.query.get(story_id)

        if not story:
            msg = 'No Story found with this ID.'
            abort(HTTP_STATUS_CODE_NOT_FOUND, msg)

        if not sketch:
            msg = 'No sketch found with this ID.'
            abort(HTTP_STATUS_CODE_NOT_FOUND, msg)

        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 story belongs to the sketch
        if story.sketch_id != sketch.id:
            abort(
                HTTP_STATUS_CODE_NOT_FOUND,
                'Sketch ID ({0:d}) does not match with the ID in '
                'the story ({1:d})'.format(sketch.id, story.sketch_id))

        # Only allow editing if the current user is the author.
        # This is needed until we have proper collaborative editing and
        # locking implemented.
        meta = dict(is_editable=False)
        if current_user == story.user:
            meta['is_editable'] = True

        return self.to_json(story, meta=meta)
def get ( self , sketch_id , story_id ) : sketch = Sketch . query . get_with_acl ( sketch_id ) story = Story . query . get ( story_id ) if not story : msg = 'No Story found with this ID.' abort ( HTTP_STATUS_CODE_NOT_FOUND , msg ) if not sketch : msg = 'No sketch found with this ID.' abort ( HTTP_STATUS_CODE_NOT_FOUND , msg ) 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 story belongs to the sketch if story . sketch_id != sketch . id : abort ( HTTP_STATUS_CODE_NOT_FOUND , 'Sketch ID ({0:d}) does not match with the ID in ' 'the story ({1:d})' . format ( sketch . id , story . sketch_id ) ) # Only allow editing if the current user is the author. # This is needed until we have proper collaborative editing and # locking implemented. meta = dict ( is_editable = False ) if current_user == story . user : meta [ 'is_editable' ] = True return self . to_json ( story , meta = meta )