Use the new save/delete/commit methods from the backend

This commit is contained in:
cncfanatics
2010-09-06 11:02:43 +02:00
parent e71004f703
commit 8aa099d146
4 changed files with 38 additions and 19 deletions

View File

@@ -32,7 +32,7 @@ class Character():
def getCharacterList(self):
baseChars = [eos.types.Character.getAll0(), eos.types.Character.getAll5()]
# Flush incase all0 & all5 weren't in the db yet
eos.db.saveddata_session.commit()
eos.db.commit()
return map(lambda c: (c.ID, c.name), eos.db.getCharacterList())
def getSkillGroups(self):

View File

@@ -44,26 +44,23 @@ class Fit(object):
fit = eos.types.Fit()
fit.ship = eos.types.Ship(eos.db.getItem(shipID))
fit.name = name
eos.db.saveddata_session.add(fit)
eos.db.saveddata_session.commit()
eos.db.save(fit)
fit.calculateModifiedAttributes()
return fit.ID
def renameFit(self, fitID, newName):
fit = eos.db.getFit(fitID)
fit.name = newName
eos.db.saveddata_session.commit()
eos.db.commit()
def deleteFit(self, fitID):
fit = eos.db.getFit(fitID)
eos.db.saveddata_session.delete(fit)
eos.db.saveddata_session.commit()
eos.db.remove(fit)
def copyFit(self, fitID):
fit = eos.db.getFit(fitID)
newFit = copy.deepcopy(fit)
eos.db.saveddata_session.add(newFit)
eos.db.saveddata_session.commit()
eos.db.save(newFit)
return newFit.ID
def getFit(self, fitID):
@@ -72,7 +69,7 @@ class Fit(object):
fit = eos.db.getFit(fitID)
fit.fill()
eos.db.saveddata_session.commit()
eos.db.commit()
return fit
def appendModule(self, fitID, itemID):
@@ -86,7 +83,7 @@ class Fit(object):
if m.fits(fit):
fit.modules.append(m)
eos.db.saveddata_session.commit()
eos.db.commit()
fit.clear()
fit.calculateModifiedAttributes()
return fit
@@ -94,7 +91,7 @@ class Fit(object):
def removeModule(self, fitID, position):
fit = eos.db.getFit(fitID)
fit.modules.toDummy(position)
eos.db.saveddata_session.commit()
eos.db.commit()
fit.clear()
fit.calculateModifiedAttributes()
return fit
@@ -112,7 +109,7 @@ class Fit(object):
fit.drones.append(d)
d.amount += 1
eos.db.saveddata_session.commit()
eos.db.commit()
fit.clear()
fit.calculateModifiedAttributes()
@@ -128,7 +125,7 @@ class Fit(object):
if d.amount == 0:
del fit.drones[i]
eos.db.saveddata_session.commit()
eos.db.commit()
fit.clear()
fit.calculateModifiedAttributes()
return fit
@@ -141,7 +138,7 @@ class Fit(object):
else:
d.amountActive = d.amount
eos.db.saveddata_session.commit()
eos.db.commit()
fit.clear()
fit.calculateModifiedAttributes()
return fit