View
@@ -12,7 +12,7 @@
from h.api.events import AnnotationEvent
from h.api import search as search_lib
from h.api import logic
from h.api import validators
from h.api import schemas
from h.api.resources import Annotation
from h.api.resources import Annotations
from h.api.resources import Root
@@ -158,11 +158,11 @@ def create(request):
status_code=400) # Client Error: Bad Request
try:
validators.Annotation().validate(fields)
except validators.Error as err:
appstruct = schemas.AnnotationSchema().validate(fields)
except schemas.ValidationError as err:
return _api_error(request, err.message, status_code=400)
annotation = logic.create_annotation(fields,
annotation = logic.create_annotation(appstruct,
userid=request.authenticated_userid)
# Notify any subscribers
@@ -197,14 +197,14 @@ def update(context, request):
status_code=400) # Client Error: Bad Request
try:
validators.Annotation().validate(fields)
except validators.Error as err:
appstruct = schemas.AnnotationSchema().validate(fields)
except schemas.ValidationError as err:
return _api_error(request, err.message, status_code=400)
# Update and store the annotation
try:
logic.update_annotation(annotation,
fields,
appstruct,
userid=request.authenticated_userid)
except RuntimeError as err:
return _api_error(
View
@@ -46,7 +46,7 @@ def run_tests(self):
'gnsq>=0.3.0,<0.4.0',
'gunicorn>=19.2,<20',
'jsonpointer==1.0',
'jsonschema==1.3.0',
'jsonschema>=2.5.1,<2.6',
'oauthlib==0.6.3',
'pyramid>=1.5,<1.6',
'psycogreen>=1.0',