(self, sketch_id)
return self.to_json(aggregation, status_code=HTTP_STATUS_CODE_CREATED)
Handles POST request to the resource.

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

        Returns:
            An aggregation in JSON (instance of flask.wrappers.Response)
Handles POST request to the resource.
Handles POST request to the resource .
def post(self, sketch_id):
        """Handles POST request to the resource.

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

        Returns:
            An aggregation in JSON (instance of flask.wrappers.Response)
        """
        form = request.json
        if not form:
            form = request.data

        if not form:
            abort(
                HTTP_STATUS_CODE_BAD_REQUEST, 'Unable to validate form data.')

        sketch = Sketch.query.get_with_acl(sketch_id)
        if not sketch:
            abort(
                HTTP_STATUS_CODE_NOT_FOUND, 'No sketch found with this ID.')

        if not sketch.has_permission(user=current_user, permission='write'):
            abort(
                HTTP_STATUS_CODE_FORBIDDEN,
                'The user does not have write permission on the sketch.')

        aggregation = self.create_aggregation_from_form(sketch, form)

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

        return self.to_json(aggregation, status_code=HTTP_STATUS_CODE_CREATED)
def post ( self , sketch_id ) : form = request . json if not form : form = request . data if not form : abort ( HTTP_STATUS_CODE_BAD_REQUEST , 'Unable to validate form data.' ) sketch = Sketch . query . get_with_acl ( sketch_id ) if not sketch : abort ( HTTP_STATUS_CODE_NOT_FOUND , 'No sketch found with this ID.' ) if not sketch . has_permission ( user = current_user , permission = 'write' ) : abort ( HTTP_STATUS_CODE_FORBIDDEN , 'The user does not have write permission on the sketch.' ) aggregation = self . create_aggregation_from_form ( sketch , form ) # Update the last activity of a sketch. utils . update_sketch_last_activity ( sketch ) return self . to_json ( aggregation , status_code = HTTP_STATUS_CODE_CREATED )