Do not fail whole import on failed modules
This commit is contained in:
@@ -332,30 +332,32 @@ class Fit(object):
|
||||
fits = []
|
||||
from eos import db
|
||||
for fitting in fittings:
|
||||
try:
|
||||
|
||||
f = Fit()
|
||||
f.name = fitting.getAttribute("name")
|
||||
shipType = fitting.getElementsByTagName("shipType").item(0).getAttribute("value")
|
||||
f.ship = Ship(db.getItem(shipType))
|
||||
hardwares = fitting.getElementsByTagName("hardware")
|
||||
for hardware in hardwares:
|
||||
moduleName = hardware.getAttribute("type")
|
||||
item = db.getItem(moduleName, eager="group.category")
|
||||
if item:
|
||||
if item.category.name == "Drone":
|
||||
d = Drone(item)
|
||||
d.amount = int(hardware.getAttribute("qty"))
|
||||
f.drones.append(d)
|
||||
else:
|
||||
m = Module(item)
|
||||
if m.isValidState(State.ACTIVE):
|
||||
m.state = State.ACTIVE
|
||||
try:
|
||||
moduleName = hardware.getAttribute("type")
|
||||
item = db.getItem(moduleName, eager="group.category")
|
||||
if item:
|
||||
if item.category.name == "Drone":
|
||||
d = Drone(item)
|
||||
d.amount = int(hardware.getAttribute("qty"))
|
||||
f.drones.append(d)
|
||||
else:
|
||||
m = Module(item)
|
||||
if m.isValidState(State.ACTIVE):
|
||||
m.state = State.ACTIVE
|
||||
|
||||
f.modules.append(m)
|
||||
f.modules.append(m)
|
||||
except Exception:
|
||||
continue
|
||||
|
||||
fits.append(f)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
return fits
|
||||
|
||||
|
||||
Reference in New Issue
Block a user