Clear import in segment api.
--- a/src/ldt/ldt/api/ldt/resources/segment.py Thu Feb 21 13:10:57 2013 +0100
+++ b/src/ldt/ldt/api/ldt/resources/segment.py Thu Feb 21 13:13:20 2013 +0100
@@ -6,8 +6,7 @@
from ldt.ldt_utils.models import Content, Segment
from ldt.ldt_utils.segmentserializer import SegmentSerializer
from tastypie.constants import ALL
-from tastypie.exceptions import BadRequest
-from tastypie.http import HttpNotFound
+from tastypie.exceptions import BadRequest, NotFound
from tastypie.resources import ModelResource
from tastypie.utils import trailing_slash
import logging
@@ -61,7 +60,7 @@
try:
page = paginator.page(int(request.GET.get('page', 1)))
except InvalidPage:
- raise HttpNotFound("Sorry, no results on that page.")
+ raise NotFound("Sorry, no results on that page.")
objects = []
@@ -85,15 +84,15 @@
returns segments about content iri_id between timecodes begin and end
"""
if not begin:
- return HttpNotFound("begin timecode argument is missing.")
+ raise NotFound("begin timecode argument is missing.")
if not end:
- return HttpNotFound("end timecode argument is missing.")
+ raise NotFound("end timecode argument is missing.")
begin = int(begin)
end = int(end)
content = Content.objects.filter(iri_id=iri_id).select_related('media_obj', 'stat_annotation')
if not content:
- return HttpNotFound("Content does not exist or id is not correct.")
+ raise NotFound("Content does not exist or id is not correct.")
content = content[0]
segments = Segment.objects.filter(content=content).filter(