Show
Ignore:
Timestamp:
06/06/04 00:03:50 (20 years ago)
Author:
jalet
Message:

Payments history is now stored in database

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/storage.py

    r1520 r1522  
    2222# 
    2323# $Log$ 
     24# Revision 1.54  2004/06/05 22:03:49  jalet 
     25# Payments history is now stored in database 
     26# 
    2427# Revision 1.53  2004/06/03 23:14:10  jalet 
    2528# Now stores the job's size in bytes in the database. 
     
    230233        self.LifeTimePaid = None 
    231234        self.Email = None 
     235        self.Payments = [] # TODO : maybe handle this smartly for SQL, for now just don't retrieve them 
    232236         
    233237    def consumeAccountBalance(self, amount) :      
     
    238242    def setAccountBalance(self, balance, lifetimepaid) :     
    239243        """Sets the user's account balance in case he pays more money.""" 
    240         self.parent.writeUserAccountBalance(self, balance, lifetimepaid) 
    241         self.AccountBalance = balance 
    242         self.LifeTimePaid = lifetimepaid 
     244        diff = float(lifetimepaid or 0.0) - float(self.LifeTimePaid or 0.0) 
     245        self.parent.beginTransaction() 
     246        try : 
     247            self.parent.writeUserAccountBalance(self, balance, lifetimepaid) 
     248            self.parent.writeNewPayment(self, diff) 
     249        except PyKotaStorageError, msg :     
     250            self.parent.rollbackTransaction() 
     251            raise PyKotaStorageError, msg 
     252        else :     
     253            self.parent.commitTransaction() 
     254            self.AccountBalance = balance 
     255            self.LifeTimePaid = lifetimepaid 
    243256         
    244257    def setLimitBy(self, limitby) :