replace empty titles with an empty string. https://github.com/qutebrowser/qutebrowser/pull/3445#issuecomment-354840724
This commit is contained in:
parent
2a7423a515
commit
9363bc3f24
@ -100,16 +100,23 @@ def clean(history):
|
|||||||
"""Clean up records from source database.
|
"""Clean up records from source database.
|
||||||
|
|
||||||
Receives a list of record and sanityze them in order for them to be
|
Receives a list of record and sanityze them in order for them to be
|
||||||
properly imported to qutebrowser. Sanitation requires addiing a 4th
|
properly imported to qutebrowser. Sanitation requires adding a 4th
|
||||||
attribute 'redirect' which is filled with '0's, and also purging all
|
attribute 'redirect' which is filled with '0's, and also purging all
|
||||||
records that have a NULL/None datetime attribute.
|
records that have a NULL/None datetime attribute.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
history: List of records (datetime, url, title) from source database.
|
history: List of records (datetime, url, title) from source database.
|
||||||
"""
|
"""
|
||||||
|
# replace missing titles with an empty string
|
||||||
|
for index, record in enumerate(history):
|
||||||
|
if record[1] is None:
|
||||||
|
cleaned = list(record)
|
||||||
|
cleaned[1] = ''
|
||||||
|
history[index] = tuple(cleaned)
|
||||||
|
|
||||||
nulls = [record for record in history if None in record]
|
nulls = [record for record in history if None in record]
|
||||||
for null_datetime in nulls:
|
for null_record in nulls:
|
||||||
history.remove(null_datetime)
|
history.remove(null_record)
|
||||||
history = [list(record) for record in history]
|
history = [list(record) for record in history]
|
||||||
for record in history:
|
for record in history:
|
||||||
record.append('0')
|
record.append('0')
|
||||||
|
Loading…
Reference in New Issue
Block a user