Changeset 1269 for pykota/trunk/pykota/storage.py
- Timestamp:
- 01/10/04 10:44:02 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storage.py
r1259 r1269 22 22 # 23 23 # $Log$ 24 # Revision 1.36 2004/01/10 09:44:02 jalet 25 # Fixed potential accuracy problem if a user printed on several printers at 26 # the very same time. 27 # 24 28 # Revision 1.35 2004/01/08 16:33:27 jalet 25 29 # Additionnal check to not create a circular printers group. … … 171 175 def consumeAccountBalance(self, amount) : 172 176 """Consumes an amount of money from the user's account balance.""" 173 newbalance = float(self.AccountBalance or 0.0) - amount 174 self.parent.writeUserAccountBalance(self, newbalance) 175 self.AccountBalance = newbalance 177 self.parent.decreaseUserAccountBalance(self, amount) 178 self.AccountBalance = float(self.AccountBalance or 0.0) - amount 176 179 177 180 def setAccountBalance(self, balance, lifetimepaid) : … … 250 253 if (printer not in self.parent.getParentPrinters(self)) and (printer.ident != self.ident) : 251 254 self.parent.writePrinterToGroup(self, printer) 255 # TODO : reset cached value for printer parents, or add new parent to cached value 252 256 253 257 def setPrices(self, priceperpage = None, priceperjob = None) : … … 301 305 self.User.consumeAccountBalance(jobprice) 302 306 for upq in [ self ] + self.ParentPrintersUserPQuota : 303 newpagecounter = int(upq.PageCounter or 0) + nbpages 304 newlifepagecounter = int(upq.LifePageCounter or 0) + nbpages 305 self.parent.writeUserPQuotaPagesCounters(upq, newpagecounter, newlifepagecounter) 306 upq.PageCounter = newpagecounter 307 upq.LifePageCounter = newlifepagecounter 307 self.parent.increaseUserPQuotaPagesCounters(upq, nbpages) 308 upq.PageCounter = int(upq.PageCounter or 0) + nbpages 309 upq.LifePageCounter = int(upq.LifePageCounter or 0) + nbpages 308 310 except PyKotaStorageError, msg : 309 311 self.parent.rollbackTransaction()