Show
Ignore:
Timestamp:
02/12/06 13:32:53 (18 years ago)
Author:
jerome
Message:

Modified pkprinters to improve speed just like I did for pkbcodes earlier.
edpykota had to be modified as well to use the new printer API.
The time spent to modify printers has been almost halved.

Files:
1 modified

Legend:

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

    r2676 r2686  
    164164            raise AttributeError, name 
    165165             
     166    def save(self) :     
     167        """Saves the billing code to disk in a single operation.""" 
     168        if self.isDirty : 
     169            self.parent.savePrinter(self) 
     170            self.isDirty = False 
     171             
    166172    def addJobToHistory(self, jobid, user, pagecounter, action, jobsize=None, jobprice=None, filename=None, title=None, copies=None, options=None, clienthost=None, jobsizebytes=None, jobmd5sum=None, jobpages=None, jobbilling=None, precomputedsize=None, precomputedprice=None) : 
    167173        """Adds a job to the printer's history.""" 
     
    190196        else :     
    191197            self.PricePerJob = float(priceperjob) 
    192         self.parent.writePrinterPrices(self) 
     198        self.isDirty = True     
    193199         
    194200    def setDescription(self, description=None) : 
     
    198204        else :     
    199205            self.Description = str(description) 
    200         self.parent.writePrinterDescription(self) 
     206        self.isDirty = True     
     207         
     208    def setPassThrough(self, passthrough) : 
     209        """Sets the printer's passthrough mode.""" 
     210        self.PassThrough = passthrough 
     211        self.isDirty = True 
     212         
     213    def setMaxJobSize(self, maxjobsize) : 
     214        """Sets the printer's maximal job size.""" 
     215        self.MaxJobSize = maxjobsize 
     216        self.isDirty = True 
    201217         
    202218    def delete(self) :     
     
    218234                    if v.Printer.Name == self.Name : 
    219235                        self.parent.flushEntry("GROUPPQUOTAS", "%s@%s" % (v.Group.Name, v.Printer.Name)) 
    220             self.Exists = 0     
     236            self.isDirty = False             
     237            self.Exists = False 
    221238         
    222239class StorageUserPQuota(StorageObject) : 
     
    453470        self.parent.deleteBillingCode(self) 
    454471        self.parent.flushEntry("BILLINGCODES", self.BillingCode) 
     472        self.isDirty = False 
    455473        self.Exists = False 
    456         self.isDirty = False 
    457474         
    458475    def reset(self, balance=0.0, pagecounter=0) :     
    459476        """Resets the pagecounter and balance for this billing code.""" 
    460         if self.Balance != balance : 
    461             self.Balance = balance 
    462             self.isDirty = True 
    463         if self.PageCounter != pagecounter : 
    464             self.PageCounter = pagecounter 
    465             self.isDirty = True 
     477        self.Balance = balance 
     478        self.PageCounter = pagecounter 
     479        self.isDirty = True 
    466480         
    467481    def setDescription(self, description=None) :