Show
Ignore:
Timestamp:
03/02/06 12:37:52 (18 years ago)
Author:
jerome
Message:

pkusers is now optimized like pkprinters, pkbcodes and edpykota.

Files:
1 modified

Legend:

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

    r2735 r2773  
    6767        self.OverCharge = 1.0 
    6868        self.Payments = [] # TODO : maybe handle this smartly for SQL, for now just don't retrieve them 
     69        self.PaymentsBacklog = [] 
    6970         
    7071    def consumeAccountBalance(self, amount) :      
     
    7879        self.AccountBalance = balance 
    7980        self.LifeTimePaid = lifetimepaid 
    80         self.parent.writeNewPayment(self, diff, comment) 
    81         self.isDirty = True 
     81        if diff : 
     82            self.PaymentsBacklog.append((diff, comment)) 
     83        self.isDirty = True 
     84         
     85    def save(self) :     
     86        """Saves an user and flush its payments backlog.""" 
     87        for (value, comment) in self.PaymentsBacklog : 
     88            self.parent.writeNewPayment(self, value, comment) 
     89        self.PaymentsBacklog = []     
     90        StorageObject.save(self)     
    8291         
    8392    def setLimitBy(self, limitby) :