# HG changeset patch # User cavaliet # Date 1361448800 -3600 # Node ID a4c1ba7c1250cac3f0199c57ac841669649cceb8 # Parent 927f75165e45243d54a1aa9511422a435dce40b6 Clear import in segment api. diff -r 927f75165e45 -r a4c1ba7c1250 src/ldt/ldt/api/ldt/resources/segment.py --- 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(