(self, sketch_id, story_id)
return self.to_json(story, status_code=HTTP_STATUS_CODE_CREATED)
Handles POST 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 view in JSON (instance of flask.wrappers.Response)
Handles POST request to the resource.
Handles POST request to the resource .
def post(self, sketch_id, story_id):
        """Handles POST 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 view 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 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))

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

        form = request.json
        if not form:
            form = request.data

        if form and form.get('export_format'):
            export_format = form.get('export_format')
            return jsonify(story=self._export_story(
                story=story, sketch_id=sketch_id, export_format=export_format))

        story.title = form.get('title', '')
        story.content = form.get('content', '[]')
        db_session.add(story)
        db_session.commit()

        # Update the last activity of a sketch.
        utils.update_sketch_last_activity(sketch)

        return self.to_json(story, status_code=HTTP_STATUS_CODE_CREATED)
def post ( 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 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 ) ) if not sketch . has_permission ( current_user , 'write' ) : abort ( HTTP_STATUS_CODE_FORBIDDEN , 'User does not have write access controls on sketch.' ) form = request . json if not form : form = request . data if form and form . get ( 'export_format' ) : export_format = form . get ( 'export_format' ) return jsonify ( story = self . _export_story ( story = story , sketch_id = sketch_id , export_format = export_format ) ) story . title = form . get ( 'title' , '' ) story . content = form . get ( 'content' , '[]' ) db_session . add ( story ) db_session . commit ( ) # Update the last activity of a sketch. utils . update_sketch_last_activity ( sketch ) return self . to_json ( story , status_code = HTTP_STATUS_CODE_CREATED )