From b4a1c8433a6babce54c80821c4ca115e457df4b7 Mon Sep 17 00:00:00 2001 From: Jack Cushman Date: Mon, 8 Jun 2015 12:27:02 -0400 Subject: [PATCH] CDX generation returns queryset instead of list. --- perma_web/warc_server/pywb_config.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/perma_web/warc_server/pywb_config.py b/perma_web/warc_server/pywb_config.py index 67ab35023..7219457e3 100644 --- a/perma_web/warc_server/pywb_config.py +++ b/perma_web/warc_server/pywb_config.py @@ -49,8 +49,7 @@ def apply_filters(self, wbrequest, matcher): except Link.DoesNotExist: raise NotFoundException() - lines = CDXLine.objects.filter(urlkey=urlkey, - asset__link_id=guid) + lines = CDXLine.objects.filter(urlkey=urlkey, asset__link_id=guid) # Legacy archives didn't generate CDXLines during # capture so generate them on demand if not found, unless @@ -62,9 +61,9 @@ def apply_filters(self, wbrequest, matcher): if asset.warc_capture in [Asset.CAPTURE_STATUS_PENDING, Asset.CAPTURE_STATUS_FAILED] or asset.cdx_lines.count() > 0: raise NotFoundException() - lines = CDXLine.objects.create_all_from_asset(asset) - lines = [line for line in lines if line.urlkey==urlkey] - if not lines: + CDXLine.objects.create_all_from_asset(asset) + lines = CDXLine.objects.filter(urlkey=urlkey, asset__link_id=guid) + if not len(lines): raise NotFoundException() # Store the line for use in PermaCDXSource