Merge branch 'master' into singularity

This commit is contained in:
DarkPhoenix
2019-05-03 03:37:48 +03:00
15 changed files with 70 additions and 192 deletions

View File

@@ -17,9 +17,8 @@
# along with eos. If not, see <http://www.gnu.org/licenses/>. # along with eos. If not, see <http://www.gnu.org/licenses/>.
# =============================================================================== # ===============================================================================
from logbook import Logger
from eos.exception import HandledListActionError from logbook import Logger
pyfalog = Logger(__name__) pyfalog = Logger(__name__)
@@ -122,7 +121,7 @@ class HandledList(list):
class HandledModuleList(HandledList): class HandledModuleList(HandledList):
def append(self, mod, raiseFailure=False): def append(self, mod):
emptyPosition = float("Inf") emptyPosition = float("Inf")
for i in range(len(self)): for i in range(len(self)):
currMod = self[i] currMod = self[i]
@@ -136,41 +135,25 @@ class HandledModuleList(HandledList):
self.__toModule(emptyPosition, mod) self.__toModule(emptyPosition, mod)
if mod.isInvalid: if mod.isInvalid:
self.__toDummy(mod.position) self.__toDummy(mod.position)
if raiseFailure: else:
raise HandledListActionError(mod) self.appendIgnoreEmpty(mod)
else:
return
return
self.appendIgnoreEmpty(mod, raiseFailure=raiseFailure) def appendIgnoreEmpty(self, mod):
def appendIgnoreEmpty(self, mod, raiseFailure=False):
mod.position = len(self) mod.position = len(self)
HandledList.append(self, mod) HandledList.append(self, mod)
if mod.isInvalid: if mod.isInvalid:
self.remove(mod) self.remove(mod)
if raiseFailure:
raise HandledListActionError(mod)
else:
return
def replace(self, idx, mod, raiseFailure=False): def replace(self, idx, mod):
try: try:
oldMod = self[idx] oldMod = self[idx]
except IndexError: except IndexError:
if raiseFailure: return
raise HandledListActionError(mod)
else:
return
self.__toModule(idx, mod) self.__toModule(idx, mod)
if mod.isInvalid: if mod.isInvalid:
self.__toModule(idx, oldMod) self.__toModule(idx, oldMod)
if raiseFailure:
raise HandledListActionError(mod)
else:
return
def replaceRackPosition(self, rackPosition, mod, raiseFailure=False): def replaceRackPosition(self, rackPosition, mod):
listPositions = [] listPositions = []
for currPos in range(len(self)): for currPos in range(len(self)):
currMod = self[currPos] currMod = self[currPos]
@@ -180,7 +163,7 @@ class HandledModuleList(HandledList):
try: try:
modListPosition = listPositions[rackPosition] modListPosition = listPositions[rackPosition]
except IndexError: except IndexError:
self.appendIgnoreEmpty(mod, raiseFailure=raiseFailure) self.appendIgnoreEmpty(mod)
else: else:
oldMod = self[modListPosition] oldMod = self[modListPosition]
if mod.isEmpty: if mod.isEmpty:
@@ -193,12 +176,8 @@ class HandledModuleList(HandledList):
self.__toDummy(modListPosition) self.__toDummy(modListPosition)
else: else:
self.__toModule(modListPosition, oldMod) self.__toModule(modListPosition, oldMod)
if raiseFailure:
raise HandledListActionError(mod)
else:
return
def insert(self, idx, mod, raiseFailure=False): def insert(self, idx, mod):
mod.position = idx mod.position = idx
i = idx i = idx
while i < len(self): while i < len(self):
@@ -207,10 +186,6 @@ class HandledModuleList(HandledList):
HandledList.insert(self, idx, mod) HandledList.insert(self, idx, mod)
if mod.isInvalid: if mod.isInvalid:
self.remove(mod) self.remove(mod)
if raiseFailure:
raise HandledListActionError(mod)
else:
return
def remove(self, mod): def remove(self, mod):
HandledList.remove(self, mod) HandledList.remove(self, mod)
@@ -248,59 +223,39 @@ class HandledDroneCargoList(HandledList):
for o in self.find(item): for o in self.find(item):
return o return o
def append(self, thing, raiseFailure=False): def append(self, thing):
HandledList.append(self, thing) HandledList.append(self, thing)
if thing.isInvalid: if thing.isInvalid:
self.remove(thing) self.remove(thing)
if raiseFailure:
raise HandledListActionError(thing)
else:
return
def insert(self, idx, thing, raiseFailure=False): def insert(self, idx, thing):
HandledList.insert(self, idx, thing) HandledList.insert(self, idx, thing)
if thing.isInvalid: if thing.isInvalid:
self.remove(thing) self.remove(thing)
if raiseFailure:
raise HandledListActionError(thing)
else:
return
class HandledImplantList(HandledList): class HandledImplantList(HandledList):
def append(self, implant, raiseFailure=False): def append(self, implant):
if implant.isInvalid: if implant.isInvalid:
HandledList.append(self, implant) HandledList.append(self, implant)
self.remove(implant) self.remove(implant)
if raiseFailure: return
raise HandledListActionError(implant)
else:
return
if self.__slotCheck(implant): if self.__slotCheck(implant):
HandledList.append(self, implant) HandledList.append(self, implant)
self.remove(implant) self.remove(implant)
if raiseFailure: return
raise HandledListActionError(implant)
else:
return
HandledList.append(self, implant) HandledList.append(self, implant)
def insert(self, idx, implant, raiseFailure=False): def insert(self, idx, implant):
if implant.isInvalid: if implant.isInvalid:
HandledList.insert(self, idx, implant) HandledList.insert(self, idx, implant)
self.remove(implant) self.remove(implant)
if raiseFailure: return
raise HandledListActionError(implant)
else:
return
if self.__slotCheck(implant): if self.__slotCheck(implant):
HandledList.insert(self, idx, implant) HandledList.insert(self, idx, implant)
self.remove(implant) self.remove(implant)
if raiseFailure: return
raise HandledListActionError(implant)
else:
return
HandledList.insert(self, idx, implant) HandledList.insert(self, idx, implant)
def makeRoom(self, implant): def makeRoom(self, implant):
@@ -322,38 +277,26 @@ class HandledImplantList(HandledList):
class HandledBoosterList(HandledList): class HandledBoosterList(HandledList):
def append(self, booster, raiseFailure=False): def append(self, booster):
if booster.isInvalid: if booster.isInvalid:
HandledList.append(self, booster) HandledList.append(self, booster)
self.remove(booster) self.remove(booster)
if raiseFailure: return
raise HandledListActionError(booster)
else:
return
if self.__slotCheck(booster): if self.__slotCheck(booster):
HandledList.append(self, booster) HandledList.append(self, booster)
self.remove(booster) self.remove(booster)
if raiseFailure: return
raise HandledListActionError(booster)
else:
return
HandledList.append(self, booster) HandledList.append(self, booster)
def insert(self, idx, booster, raiseFailure=False): def insert(self, idx, booster):
if booster.isInvalid: if booster.isInvalid:
HandledList.insert(self, idx, booster) HandledList.insert(self, idx, booster)
self.remove(booster) self.remove(booster)
if raiseFailure: return
raise HandledListActionError(booster)
else:
return
if self.__slotCheck(booster): if self.__slotCheck(booster):
HandledList.insert(self, idx, booster) HandledList.insert(self, idx, booster)
self.remove(booster) self.remove(booster)
if raiseFailure: return
raise HandledListActionError(booster)
else:
return
HandledList.insert(self, idx, booster) HandledList.insert(self, idx, booster)
def makeRoom(self, booster): def makeRoom(self, booster):
@@ -386,51 +329,31 @@ class HandledSsoCharacterList(list):
class HandledProjectedModList(HandledList): class HandledProjectedModList(HandledList):
def append(self, proj, raiseFailure=False): def append(self, proj):
if proj.isInvalid: if proj.isInvalid:
# we must include it before we remove it. doing it this way ensures # we must include it before we remove it. doing it this way ensures
# rows and relationships in database are removed as well # rows and relationships in database are removed as well
HandledList.append(self, proj) HandledList.append(self, proj)
self.remove(proj) self.remove(proj)
if raiseFailure: return
raise HandledListActionError(proj)
else:
return
proj.projected = True proj.projected = True
HandledList.append(self, proj) HandledList.append(self, proj)
# Remove non-projectable modules # Remove non-projectable modules
if not proj.item.isType("projected") and not proj.isExclusiveSystemEffect: if not proj.item.isType("projected") and not proj.isExclusiveSystemEffect:
self.remove(proj) self.remove(proj)
if raiseFailure:
raise HandledListActionError(proj)
else:
return
def insert(self, idx, proj, raiseFailure=False): def insert(self, idx, proj):
if proj.isInvalid: if proj.isInvalid:
# we must include it before we remove it. doing it this way ensures # we must include it before we remove it. doing it this way ensures
# rows and relationships in database are removed as well # rows and relationships in database are removed as well
HandledList.insert(self, idx, proj) HandledList.insert(self, idx, proj)
self.remove(proj) self.remove(proj)
if raiseFailure: return
raise HandledListActionError(proj)
else:
return
proj.projected = True proj.projected = True
HandledList.insert(self, idx, proj) HandledList.insert(self, idx, proj)
# Remove non-projectable modules # Remove non-projectable modules
if not proj.item.isType("projected") and not proj.isExclusiveSystemEffect: if not proj.item.isType("projected") and not proj.isExclusiveSystemEffect:
self.remove(proj) self.remove(proj)
if raiseFailure:
raise HandledListActionError(proj)
else:
return
@property @property
def currentSystemEffect(self): def currentSystemEffect(self):
@@ -454,31 +377,21 @@ class HandledProjectedModList(HandledList):
class HandledProjectedDroneList(HandledDroneCargoList): class HandledProjectedDroneList(HandledDroneCargoList):
def append(self, proj, raiseFailure=False): def append(self, proj):
proj.projected = True proj.projected = True
HandledList.append(self, proj) HandledList.append(self, proj)
# Remove invalid or non-projectable drones # Remove invalid or non-projectable drones
if proj.isInvalid or not proj.item.isType("projected"): if proj.isInvalid or not proj.item.isType("projected"):
self.remove(proj) self.remove(proj)
proj.projected = False proj.projected = False
if raiseFailure:
raise HandledListActionError(proj)
else:
return
def insert(self, idx, proj, raiseFailure=False): def insert(self, idx, proj):
proj.projected = True proj.projected = True
HandledList.insert(self, idx, proj) HandledList.insert(self, idx, proj)
# Remove invalid or non-projectable drones # Remove invalid or non-projectable drones
if proj.isInvalid or not proj.item.isType("projected"): if proj.isInvalid or not proj.item.isType("projected"):
self.remove(proj) self.remove(proj)
proj.projected = False proj.projected = False
if raiseFailure:
raise HandledListActionError(proj)
else:
return
class HandledItem(object): class HandledItem(object):

View File

@@ -1,2 +0,0 @@
class HandledListActionError(Exception):
...

View File

@@ -2,7 +2,6 @@ import wx
from logbook import Logger from logbook import Logger
import eos.db import eos.db
from eos.exception import HandledListActionError
from service.fit import Fit from service.fit import Fit
@@ -35,9 +34,8 @@ class CalcAddBoosterCommand(wx.Command):
self.oldPosition, self.oldBoosterInfo = fit.boosters.makeRoom(newBooster) self.oldPosition, self.oldBoosterInfo = fit.boosters.makeRoom(newBooster)
if self.newPosition is not None: if self.newPosition is not None:
try: fit.boosters.insert(self.newPosition, newBooster)
fit.boosters.insert(self.newPosition, newBooster, raiseFailure=True) if newBooster not in fit.boosters:
except HandledListActionError:
pyfalog.warning('Failed to insert to list') pyfalog.warning('Failed to insert to list')
cmd = CalcAddBoosterCommand( cmd = CalcAddBoosterCommand(
fitID=self.fitID, fitID=self.fitID,
@@ -47,9 +45,8 @@ class CalcAddBoosterCommand(wx.Command):
cmd.Do() cmd.Do()
return False return False
else: else:
try: fit.boosters.append(newBooster)
fit.boosters.append(newBooster, raiseFailure=True) if newBooster not in fit.boosters:
except HandledListActionError:
pyfalog.warning('Failed to append to list') pyfalog.warning('Failed to append to list')
cmd = CalcAddBoosterCommand( cmd = CalcAddBoosterCommand(
fitID=self.fitID, fitID=self.fitID,

View File

@@ -2,7 +2,6 @@ import wx
from logbook import Logger from logbook import Logger
import eos.db import eos.db
from eos.exception import HandledListActionError
from service.fit import Fit from service.fit import Fit
@@ -25,9 +24,8 @@ class CalcAddCargoCommand(wx.Command):
cargo.amount += self.cargoInfo.amount cargo.amount += self.cargoInfo.amount
else: else:
cargo = self.cargoInfo.toCargo() cargo = self.cargoInfo.toCargo()
try: fit.cargo.append(cargo)
fit.cargo.append(cargo, raiseFailure=True) if cargo not in fit.cargo:
except HandledListActionError:
pyfalog.warning('Failed to append to list') pyfalog.warning('Failed to append to list')
if self.commit: if self.commit:
eos.db.commit() eos.db.commit()

View File

@@ -3,7 +3,6 @@ import wx
from logbook import Logger from logbook import Logger
import eos.db import eos.db
from eos.exception import HandledListActionError
from gui.fitCommands.helpers import DroneInfo, droneStackLimit from gui.fitCommands.helpers import DroneInfo, droneStackLimit
from service.fit import Fit from service.fit import Fit
from service.market import Market from service.market import Market
@@ -50,9 +49,8 @@ class CalcAddLocalDroneCommand(wx.Command):
if not self.ignoreRestrictions and not drone.fits(fit): if not self.ignoreRestrictions and not drone.fits(fit):
pyfalog.warning('Drone does not fit') pyfalog.warning('Drone does not fit')
return False return False
try: fit.drones.append(drone)
fit.drones.append(drone, raiseFailure=True) if drone not in fit.drones:
except HandledListActionError:
pyfalog.warning('Failed to append to list') pyfalog.warning('Failed to append to list')
if self.commit: if self.commit:
eos.db.commit() eos.db.commit()

View File

@@ -2,7 +2,6 @@ import wx
from logbook import Logger from logbook import Logger
import eos.db import eos.db
from eos.exception import HandledListActionError
from gui.fitCommands.helpers import DroneInfo from gui.fitCommands.helpers import DroneInfo
from service.fit import Fit from service.fit import Fit
@@ -48,9 +47,8 @@ class CalcRemoveLocalDroneCommand(wx.Command):
drone = self.savedDroneInfo.toDrone() drone = self.savedDroneInfo.toDrone()
if drone is None: if drone is None:
return False return False
try: fit.drones.insert(self.position, drone)
fit.drones.insert(self.position, drone, raiseFailure=True) if drone not in fit.drones:
except HandledListActionError:
pyfalog.warning('Failed to insert to list') pyfalog.warning('Failed to insert to list')
if self.commit: if self.commit:
eos.db.commit() eos.db.commit()

View File

@@ -4,7 +4,6 @@ import wx
from logbook import Logger from logbook import Logger
import eos.db import eos.db
from eos.exception import HandledListActionError
from gui.fitCommands.helpers import DroneInfo from gui.fitCommands.helpers import DroneInfo
from service.fit import Fit from service.fit import Fit
@@ -43,9 +42,8 @@ class CalcAddProjectedDroneCommand(wx.Command):
if not drone.item.isType('projected'): if not drone.item.isType('projected'):
pyfalog.debug('Drone is not projectable') pyfalog.debug('Drone is not projectable')
return False return False
try: fit.projectedDrones.append(drone)
fit.projectedDrones.append(drone, raiseFailure=True) if drone not in fit.projectedDrones:
except HandledListActionError:
pyfalog.warning('Failed to append to list') pyfalog.warning('Failed to append to list')
if self.commit: if self.commit:
eos.db.commit() eos.db.commit()

View File

@@ -2,7 +2,6 @@ import wx
from logbook import Logger from logbook import Logger
import eos.db import eos.db
from eos.exception import HandledListActionError
from service.fit import Fit from service.fit import Fit
@@ -41,18 +40,16 @@ class CalcAddLocalFighterCommand(wx.Command):
fighter.active = True fighter.active = True
if self.position is None: if self.position is None:
try: fit.fighters.append(fighter)
fit.fighters.append(fighter, raiseFailure=True) if fighter not in fit.fighters:
except HandledListActionError:
pyfalog.warning('Failed to append to list') pyfalog.warning('Failed to append to list')
if self.commit: if self.commit:
eos.db.commit() eos.db.commit()
return False return False
self.position = fit.fighters.index(fighter) self.position = fit.fighters.index(fighter)
else: else:
try: fit.fighters.insert(self.position, fighter)
fit.fighters.insert(self.position, fighter, raiseFailure=True) if fighter not in fit.fighters:
except HandledListActionError:
pyfalog.warning('Failed to insert to list') pyfalog.warning('Failed to insert to list')
if self.commit: if self.commit:
eos.db.commit() eos.db.commit()

View File

@@ -2,7 +2,6 @@ import wx
from logbook import Logger from logbook import Logger
import eos.db import eos.db
from eos.exception import HandledListActionError
from service.fit import Fit from service.fit import Fit
@@ -25,16 +24,14 @@ class CalcAddProjectedFighterCommand(wx.Command):
return False return False
fit = Fit.getInstance().getFit(self.fitID) fit = Fit.getInstance().getFit(self.fitID)
if self.position is not None: if self.position is not None:
try: fit.projectedFighters.insert(self.position, fighter)
fit.projectedFighters.insert(self.position, fighter, raiseFailure=True) if fighter not in fit.projectedFighters:
except HandledListActionError:
if self.commit: if self.commit:
eos.db.commit() eos.db.commit()
return False return False
else: else:
try: fit.projectedFighters.append(fighter)
fit.projectedFighters.append(fighter, raiseFailure=True) if fighter not in fit.projectedFighters:
except HandledListActionError:
if self.commit: if self.commit:
eos.db.commit() eos.db.commit()
return False return False

View File

@@ -2,7 +2,6 @@ import wx
from logbook import Logger from logbook import Logger
import eos.db import eos.db
from eos.exception import HandledListActionError
from service.fit import Fit from service.fit import Fit
@@ -35,9 +34,8 @@ class CalcAddImplantCommand(wx.Command):
self.oldPosition, self.oldImplantInfo = fit.implants.makeRoom(newImplant) self.oldPosition, self.oldImplantInfo = fit.implants.makeRoom(newImplant)
if self.newPosition is not None: if self.newPosition is not None:
try: fit.implants.insert(self.newPosition, newImplant)
fit.implants.insert(self.newPosition, newImplant, raiseFailure=True) if newImplant not in fit.implants:
except HandledListActionError:
pyfalog.warning('Failed to insert to list') pyfalog.warning('Failed to insert to list')
cmd = CalcAddImplantCommand( cmd = CalcAddImplantCommand(
fitID=self.fitID, fitID=self.fitID,
@@ -47,9 +45,8 @@ class CalcAddImplantCommand(wx.Command):
cmd.Do() cmd.Do()
return False return False
else: else:
try: fit.implants.append(newImplant)
fit.implants.append(newImplant, raiseFailure=True) if newImplant not in fit.implants:
except HandledListActionError:
pyfalog.warning('Failed to append to list') pyfalog.warning('Failed to append to list')
cmd = CalcAddImplantCommand( cmd = CalcAddImplantCommand(
fitID=self.fitID, fitID=self.fitID,

View File

@@ -2,7 +2,6 @@ import wx
from logbook import Logger from logbook import Logger
import eos.db import eos.db
from eos.exception import HandledListActionError
from gui.fitCommands.helpers import restoreCheckedStates, stateLimit from gui.fitCommands.helpers import restoreCheckedStates, stateLimit
from service.fit import Fit from service.fit import Fit
@@ -55,9 +54,8 @@ class CalcAddLocalModuleCommand(wx.Command):
if not newMod.fits(fit): if not newMod.fits(fit):
pyfalog.warning('Module does not fit') pyfalog.warning('Module does not fit')
return False return False
try: fit.modules.append(newMod)
fit.modules.append(newMod, raiseFailure=True) if newMod not in fit.modules:
except HandledListActionError:
pyfalog.warning('Failed to append to list') pyfalog.warning('Failed to append to list')
if self.commit: if self.commit:
eos.db.commit() eos.db.commit()

View File

@@ -4,7 +4,6 @@ import wx
from logbook import Logger from logbook import Logger
import eos.db import eos.db
from eos.exception import HandledListActionError
from gui.fitCommands.helpers import restoreCheckedStates from gui.fitCommands.helpers import restoreCheckedStates
from service.fit import Fit from service.fit import Fit
@@ -31,9 +30,8 @@ class CalcCloneLocalModuleCommand(wx.Command):
return False return False
if not fit.modules[self.dstPosition].isEmpty: if not fit.modules[self.dstPosition].isEmpty:
return False return False
try: fit.modules.replace(self.dstPosition, copyMod)
fit.modules.replace(self.dstPosition, copyMod, raiseFailure=True) if copyMod not in fit.modules:
except HandledListActionError:
pyfalog.warning('Failed to replace module') pyfalog.warning('Failed to replace module')
eos.db.commit() eos.db.commit()
return False return False

View File

@@ -2,7 +2,6 @@ import wx
from logbook import Logger from logbook import Logger
import eos.db import eos.db
from eos.exception import HandledListActionError
from gui.fitCommands.helpers import ModuleInfo, restoreCheckedStates, stateLimit from gui.fitCommands.helpers import ModuleInfo, restoreCheckedStates, stateLimit
from service.fit import Fit from service.fit import Fit
@@ -53,9 +52,8 @@ class CalcReplaceLocalModuleCommand(wx.Command):
pyfalog.warning('Invalid charge') pyfalog.warning('Invalid charge')
self.Undo() self.Undo()
return False return False
try: fit.modules.replace(self.position, newMod)
fit.modules.replace(self.position, newMod, raiseFailure=True) if newMod not in fit.modules:
except HandledListActionError:
pyfalog.warning('Failed to replace in list') pyfalog.warning('Failed to replace in list')
self.Undo() self.Undo()
return False return False
@@ -87,9 +85,8 @@ class CalcReplaceLocalModuleCommand(wx.Command):
if oldMod is None: if oldMod is None:
return False return False
fit.modules.free(self.position) fit.modules.free(self.position)
try: fit.modules.replace(self.position, oldMod)
fit.modules.replace(self.position, oldMod, raiseFailure=True) if oldMod not in fit.modules:
except HandledListActionError:
pyfalog.warning('Failed to replace in list') pyfalog.warning('Failed to replace in list')
self.Do() self.Do()
return False return False

View File

@@ -2,7 +2,6 @@ import wx
from logbook import Logger from logbook import Logger
import eos.db import eos.db
from eos.exception import HandledListActionError
from service.fit import Fit from service.fit import Fit
@@ -33,16 +32,14 @@ class CalcSwapLocalModuleCommand(wx.Command):
mod2 = fit.modules[position2] mod2 = fit.modules[position2]
fit.modules.free(position1) fit.modules.free(position1)
fit.modules.free(position2) fit.modules.free(position2)
try: fit.modules.replace(position2, mod1)
fit.modules.replace(position2, mod1, raiseFailure=True) if len(fit.modules) <= position2 or fit.modules[position2] is not mod1:
except HandledListActionError:
fit.modules.replace(position1, mod1) fit.modules.replace(position1, mod1)
fit.modules.replace(position2, mod2) fit.modules.replace(position2, mod2)
eos.db.commit() eos.db.commit()
return False return False
try: fit.modules.replace(position1, mod2)
fit.modules.replace(position1, mod2, raiseFailure=True) if len(fit.modules) <= position1 or fit.modules[position1] is not mod2:
except HandledListActionError:
fit.modules.free(position2) fit.modules.free(position2)
fit.modules.replace(position1, mod1) fit.modules.replace(position1, mod1)
fit.modules.replace(position2, mod2) fit.modules.replace(position2, mod2)

View File

@@ -3,7 +3,6 @@ from logbook import Logger
import eos.db import eos.db
from eos.const import FittingModuleState from eos.const import FittingModuleState
from eos.exception import HandledListActionError
from gui.fitCommands.helpers import restoreCheckedStates from gui.fitCommands.helpers import restoreCheckedStates
from service.fit import Fit from service.fit import Fit
@@ -39,16 +38,14 @@ class CalcAddProjectedModuleCommand(wx.Command):
self.oldPosition, self.oldModInfo = fit.projectedModules.makeRoom(newMod) self.oldPosition, self.oldModInfo = fit.projectedModules.makeRoom(newMod)
if self.newPosition is not None: if self.newPosition is not None:
try: fit.projectedModules.insert(self.newPosition, newMod)
fit.projectedModules.insert(self.newPosition, newMod, raiseFailure=True) if newMod not in fit.projectedModules:
except HandledListActionError:
if self.commit: if self.commit:
eos.db.commit() eos.db.commit()
return False return False
else: else:
try: fit.projectedModules.append(newMod)
fit.projectedModules.append(newMod, raiseFailure=True) if newMod not in fit.projectedModules:
except HandledListActionError:
if self.commit: if self.commit:
eos.db.commit() eos.db.commit()
return False return False