Show
Ignore:
Timestamp:
11/13/03 00:29:24 (21 years ago)
Author:
jalet
Message:

More work on new backend. This commit may be unstable.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/accounters/stupid.py

    r1144 r1180  
    2222# 
    2323# $Log$ 
     24# Revision 1.6  2003/11/12 23:29:24  jalet 
     25# More work on new backend. This commit may be unstable. 
     26# 
    2427# Revision 1.5  2003/10/07 09:07:29  jalet 
    2528# Character encoding added to please latest version of Python 
     
    4649 
    4750class Accounter(AccounterBase) : 
     51    def beginJob(self) :     
     52        """Saves the computed job size.""" 
     53        self.JobSize = self.computeJobSize() 
     54         
     55        # get last job information for this printer 
     56        if not printer.LastJob.Exists : 
     57            # The printer hasn't been used yet, from PyKota's point of view 
     58            self.LastPageCounter = 0 
     59        else :     
     60            # get last job size and page counter from Quota Storage 
     61            # Last lifetime page counter before actual job is  
     62            # last page counter + last job size 
     63            self.LastPageCounter = int(printer.LastJob.PrinterPageCounter or 0) + int(printer.LastJob.JobSize or 0) 
     64         
     65    def endJob(self) :     
     66        """Do nothing.""" 
     67        pass 
     68         
     69    def getJobSize(self) :     
     70        """Returns the actual job size.""" 
     71        try : 
     72            return self.JobSize 
     73        except AttributeError :     
     74            return 0 
     75         
    4876    def doAccounting(self, printer, user) : 
    4977        """Does print accounting by stupidly counting the 'showpage' postscript instructions in the document. 
     
    5583         
    5684        # get the job size     
    57         jobsize = self.getJobSize() * self.filter.copies 
     85        jobsize = self.computeJobSize() * self.filter.copies 
    5886             
    5987        # get last job information for this printer 
     
    82110        return action 
    83111         
    84     def getJobSize(self) :     
     112    def computeJobSize(self) :     
    85113        """Computes the job size and return its value. 
    86114