Safer user of "lower"

This commit is contained in:
Mouse Reeve 2021-12-14 12:50:53 -08:00
parent bee3c86223
commit ba390dc3ad

View file

@ -90,7 +90,10 @@ class Importer:
def get_shelf(self, normalized_row): def get_shelf(self, normalized_row):
"""determine which shelf to use""" """determine which shelf to use"""
shelf_name = normalized_row["shelf"].lower() shelf_name = normalized_row.get("shelf")
if not shelf_name:
return None
shelf_name = shelf_name.lower()
shelf = [ shelf = [
s for (s, gs) in self.shelf_mapping_guesses.items() if shelf_name in gs s for (s, gs) in self.shelf_mapping_guesses.items() if shelf_name in gs
] ]