Changeset 1180 for pykota/trunk/pykota/accounters/stupid.py
- Timestamp:
- 11/13/03 00:29:24 (21 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/accounters/stupid.py
r1144 r1180 22 22 # 23 23 # $Log$ 24 # Revision 1.6 2003/11/12 23:29:24 jalet 25 # More work on new backend. This commit may be unstable. 26 # 24 27 # Revision 1.5 2003/10/07 09:07:29 jalet 25 28 # Character encoding added to please latest version of Python … … 46 49 47 50 class 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 48 76 def doAccounting(self, printer, user) : 49 77 """Does print accounting by stupidly counting the 'showpage' postscript instructions in the document. … … 55 83 56 84 # get the job size 57 jobsize = self. getJobSize() * self.filter.copies85 jobsize = self.computeJobSize() * self.filter.copies 58 86 59 87 # get last job information for this printer … … 82 110 return action 83 111 84 def getJobSize(self) :112 def computeJobSize(self) : 85 113 """Computes the job size and return its value. 86 114