Changeset 1359 for pykota

Show
Ignore:
Timestamp:
02/25/04 13:36:34 (21 years ago)
Author:
jalet
Message:

Avoids a database query even if caching was disabled.

Location:
pykota/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/pykota

    r1292 r1359  
    2424# 
    2525# $Log$ 
     26# Revision 1.53  2004/02/25 12:36:34  jalet 
     27# Avoids a database query even if caching was disabled. 
     28# 
    2629# Revision 1.52  2004/01/14 15:57:54  jalet 
    2730# Missing return caused problems with LPRng 
     
    299302                    lastjobsize = self.accounter.getJobSize() 
    300303                    self.logdebug("Last Job size : %i" % lastjobsize) 
    301                     printer.LastJob.setSize(lastjobsize) 
     304                    printer.LastJob.setSize(lastuserpquota, lastjobsize) 
    302305                    self.logdebug("Updating user %s's quota on printer %s" % (lastuserpquota.User.Name, printer.Name)) 
    303306                    lastuserpquota.increasePagesUsage(lastjobsize) 
  • pykota/trunk/pykota/storage.py

    r1358 r1359  
    2222# 
    2323# $Log$ 
     24# Revision 1.43  2004/02/25 12:36:34  jalet 
     25# Avoids a database query even if caching was disabled. 
     26# 
    2427# Revision 1.42  2004/02/23 22:53:21  jalet 
    2528# Don't retrieve data when it's not needed, to avoid database queries 
     
    428431    def __init__(self, parent, printer) : 
    429432        StorageJob.__init__(self, parent) 
     433        self.PrinterName = printer.Name # not needed 
    430434        self.Printer = printer 
    431         self.UserName = None 
    432435         
    433436    def __getattr__(self, name) :     
     
    439442            raise AttributeError, name 
    440443         
    441     def setSize(self, jobsize) : 
     444    def setSize(self, userpquota, jobsize) : 
    442445        """Sets the last job's size.""" 
    443         jobprice = self.parent.getUserPQuota(self.User, self.Printer).computeJobPrice(jobsize) 
     446        jobprice = userpquota.computeJobPrice(jobsize) 
    444447        self.parent.writeLastJobSize(self, jobsize, jobprice) 
    445448        self.JobSize = jobsize