Ejemplo n.º 1
0
Archivo: views.py Proyecto: 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()
Ejemplo n.º 2
0
Archivo: views.py Proyecto: 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()
Ejemplo n.º 3
0
Archivo: views.py Proyecto: 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()
Ejemplo n.º 4
0
Archivo: views.py Proyecto: 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()
Ejemplo n.º 5
0
Archivo: views.py Proyecto: djcun95/h
def read(annotation, request):
    """Return the annotation (simply how it was stored in the database)."""
    presenter = AnnotationJSONPresenter(request, annotation)
    return presenter.asdict()
Ejemplo n.º 6
0
def read(annotation, request):
    """Return the annotation (simply how it was stored in the database)."""
    presenter = AnnotationJSONPresenter(request, annotation)
    return presenter.asdict()