1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

cdx sorted output: switch to default list.sort() for cdx output, fixes #608 (#609)

This commit is contained in:
Ilya Kreymer 2021-01-26 14:35:30 -08:00 committed by GitHub
parent 841c02c123
commit 4683d95580
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,7 +27,6 @@ except ImportError: # pragma: no cover
from argparse import ArgumentParser, RawTextHelpFormatter from argparse import ArgumentParser, RawTextHelpFormatter
from bisect import insort
from six import StringIO from six import StringIO
@ -167,9 +166,10 @@ class SortedCDXWriter(BaseCDXWriter):
super(SortedCDXWriter, self).write(entry, filename) super(SortedCDXWriter, self).write(entry, filename)
line = self.out.getvalue() line = self.out.getvalue()
if line: if line:
insort(self.sortlist, line) self.sortlist.append(line)
def __exit__(self, *args): def __exit__(self, *args):
self.sortlist.sort()
self.actual_out.write(''.join(self.sortlist)) self.actual_out.write(''.join(self.sortlist))
return False return False