From 7ee4d1d5887caecd3d1f8e403d9fcbe038e4e0ab Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Mon, 26 Dec 2016 23:29:22 -0800 Subject: [PATCH 1/2] Try loading item as a booster if implant fails. --- service/port.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/service/port.py b/service/port.py index 66e105c06..702e836fb 100644 --- a/service/port.py +++ b/service/port.py @@ -406,7 +406,11 @@ class Port(object): cargoMap[modName] = 0 cargoMap[modName] += extraAmount elif item.category.name == "Implant": - fit.implants.append(Implant(item)) + try: + fit.implants.append(Implant(item)) + except ValueError: + # Passed item isn't an implant. Try loading it as a booster. + fit.boosters.append(Booster(item)) # elif item.category.name == "Subsystem": # try: # subsystem = Module(item) From f9ba95b3ded19e17a84a21002afd731bfe81c996 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Tue, 27 Dec 2016 12:32:52 -0800 Subject: [PATCH 2/2] Check the `ness` to see if it's an implant, booster, or something else. Log it if it's something else and don't try and import it. This prevents a bad line from failing the entire import, and (hopefully) we know about it. --- service/port.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/service/port.py b/service/port.py index 702e836fb..f0b24306b 100644 --- a/service/port.py +++ b/service/port.py @@ -406,11 +406,12 @@ class Port(object): cargoMap[modName] = 0 cargoMap[modName] += extraAmount elif item.category.name == "Implant": - try: + if "implantness" in item.attributes: fit.implants.append(Implant(item)) - except ValueError: - # Passed item isn't an implant. Try loading it as a booster. + elif "boosterness" in item.attributes: fit.boosters.append(Booster(item)) + else: + logger.error("Failed to import implant: %s", line) # elif item.category.name == "Subsystem": # try: # subsystem = Module(item)