def update(annotation, request): """Update the specified annotation with data from the PUT payload.""" schema = schemas.UpdateAnnotationSchema(request, annotation=annotation) appstruct = schema.validate(_json_payload(request)) annotation = storage.update_annotation(request, annotation.id, appstruct) _publish_annotation_event(request, annotation, 'update') presenter = AnnotationJSONPresenter(annotation) return presenter.asdict()
def create(request): """Create an annotation from the POST payload.""" schema = schemas.CreateAnnotationSchema(request) appstruct = schema.validate(_json_payload(request)) annotation = storage.create_annotation(request, appstruct) _publish_annotation_event(request, annotation, 'create') presenter = AnnotationJSONPresenter(annotation) return presenter.asdict()
def update(annotation, request): """Update the specified annotation with data from the PUT payload.""" schema = schemas.UpdateAnnotationSchema(request, annotation=annotation) appstruct = schema.validate(_json_payload(request)) annotation = storage.update_annotation(request, annotation.id, appstruct) _publish_annotation_event(request, annotation, 'update') presenter = AnnotationJSONPresenter(annotation) return presenter.asdict()
def create(request): """Create an annotation from the POST payload.""" schema = schemas.CreateAnnotationSchema(request) appstruct = schema.validate(_json_payload(request)) annotation = storage.create_annotation(request, appstruct) _publish_annotation_event(request, annotation, 'create') presenter = AnnotationJSONPresenter(annotation) return presenter.asdict()
def read(annotation, request): """Return the annotation (simply how it was stored in the database).""" presenter = AnnotationJSONPresenter(request, annotation) return presenter.asdict()
def read(annotation, request): """Return the annotation (simply how it was stored in the database).""" presenter = AnnotationJSONPresenter(request, annotation) return presenter.asdict()