diff --git a/eos/db/saveddata/fit.py b/eos/db/saveddata/fit.py index 0677728d8..0c5edaee9 100644 --- a/eos/db/saveddata/fit.py +++ b/eos/db/saveddata/fit.py @@ -53,6 +53,8 @@ mapper(Fit, fits_table, "_Fit__projectedModules" : relation(Module, collection_class = HandledProjectedModList, cascade='all, delete, delete-orphan', single_parent=True, primaryjoin = and_(modules_table.c.fitID == fits_table.c.ID, modules_table.c.projected == True)), "owner" : relation(User, backref = "fits"), + "itemID" : fits_table.c.shipID, + "shipID" : fits_table.c.shipID, "_Fit__boosters" : relation(Booster, collection_class = HandledImplantBoosterList, cascade='all, delete, delete-orphan', single_parent=True), "_Fit__drones" : relation(Drone, collection_class = HandledDroneCargoList, cascade='all, delete, delete-orphan', single_parent=True, primaryjoin = and_(drones_table.c.fitID == fits_table.c.ID, drones_table.c.projected == False)), diff --git a/eos/effectHandlerHelpers.py b/eos/effectHandlerHelpers.py index 1311dcf6a..a417fa041 100644 --- a/eos/effectHandlerHelpers.py +++ b/eos/effectHandlerHelpers.py @@ -102,6 +102,11 @@ class HandledList(list): except AttributeError: pass + def remove(self, thing): + # We must flag it as modified, otherwise it not be removed from the database + flag_modified(thing, "itemID") + list.remove(self, thing) + class HandledModuleList(HandledList): def append(self, mod): emptyPosition = float("Inf") @@ -168,8 +173,6 @@ class HandledDroneCargoList(HandledList): HandledList.append(self, thing) if thing.isInvalid: - # we must flag it as modified, otherwise it will not be removed from the database - flag_modified(thing, "itemID") self.remove(thing) class HandledImplantBoosterList(HandledList): @@ -185,11 +188,6 @@ class HandledImplantBoosterList(HandledList): HandledList.append(self, thing) - def remove(self, thing): - # We must flag it as modified, otherwise it not be removed from the database - flag_modified(thing, "itemID") - HandledList.remove(self, thing) - class HandledProjectedModList(HandledList): def append(self, proj): if proj.isInvalid: diff --git a/eos/saveddata/cargo.py b/eos/saveddata/cargo.py index fa68de1a0..7f7542a0b 100644 --- a/eos/saveddata/cargo.py +++ b/eos/saveddata/cargo.py @@ -23,7 +23,7 @@ from sqlalchemy.orm import validates, reconstructor import eos.db -class Cargo(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut): +class Cargo(HandledItem, ItemAttrShortcut): def __init__(self, item): """Initialize cargo from the program"""