예제 #1
0
파일: views.py 프로젝트: hashin/h
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()
예제 #2
0
파일: views.py 프로젝트: hashin/h
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()
예제 #3
0
파일: views.py 프로젝트: hashin/h
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()
예제 #4
0
파일: views.py 프로젝트: hashin/h
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()
예제 #5
0
파일: views.py 프로젝트: djcun95/h
def read(annotation, request):
    """Return the annotation (simply how it was stored in the database)."""
    presenter = AnnotationJSONPresenter(request, annotation)
    return presenter.asdict()
예제 #6
0
def read(annotation, request):
    """Return the annotation (simply how it was stored in the database)."""
    presenter = AnnotationJSONPresenter(request, annotation)
    return presenter.asdict()