Changeset 1609 for pykota/trunk/bin
- Timestamp:
- 07/21/04 00:47:38 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/lprngpykota
r1601 r1609 24 24 # 25 25 # $Log$ 26 # Revision 1.2 2004/07/20 22:47:38 jalet 27 # Sanitizing 28 # 26 29 # Revision 1.1 2004/07/17 20:37:27 jalet 27 30 # Missing file... Am I really stupid ? … … 99 102 self.softwareJobSize = self.precomputeJobSize() 100 103 self.softwareJobPrice = userpquota.computeJobPrice(self.softwareJobSize) 101 self. sendBackChannelData("Precomputed job's size is %s pages, price is %s units" % (self.softwareJobSize, self.softwareJobPrice))104 self.logdebug("Precomputed job's size is %s pages, price is %s units" % (self.softwareJobSize, self.softwareJobPrice)) 102 105 os.environ["PYKOTAPRECOMPUTEDJOBSIZE"] = str(self.softwareJobSize) 103 106 os.environ["PYKOTAPRECOMPUTEDJOBPRICE"] = str(self.softwareJobPrice) 104 105 # checks the user's quota106 action = self.warnUserPQuota(userpquota)107 107 108 108 # if no data to pass to real backend, probably a filter … … 112 112 self.printInfo(_("Job contains no data. Printing is denied."), "warn") 113 113 action = "DENY" 114 else : 115 # checks the user's quota 116 action = self.warnUserPQuota(userpquota) 114 117 115 118 # exports some new environment variables … … 119 122 self.prehook(userpquota) 120 123 121 self. sendBackChannelData("Job accounting begins.")124 self.logdebug("Job accounting begins.") 122 125 self.accounter.beginJob(userpquota) 123 126 … … 126 129 self.accounter.endJob(userpquota) 127 130 jobsize = self.accounter.getJobSize() 128 self. sendBackChannelData("Job accounting ends.")131 self.logdebug("Job accounting ends.") 129 132 130 133 if action == "DENY" : 131 134 jobsize = 0 132 self. sendBackChannelData("Job size forced to 0 because printing was denied.")135 self.logdebug("Job size forced to 0 because printing was denied.") 133 136 134 137 if jobsize is not None : 135 138 # update the quota for the current user on this printer 136 self. sendBackChannelData("Job size : %i" % jobsize)137 self. sendBackChannelData("Updating user %s's quota on printer %s" % (user.Name, printer.Name))139 self.logdebug("Job size : %i" % jobsize) 140 self.logdebug("Updating user %s's quota on printer %s" % (user.Name, printer.Name)) 138 141 jobprice = userpquota.increasePagesUsage(jobsize) 139 142 140 143 printer.addJobToHistory(self.jobid, user, self.accounter.getLastPageCounter(), action, jobsize, jobprice, self.preserveinputfile, self.title, self.copies, self.options, clienthost, self.jobSizeBytes) 141 self. sendBackChannelData("Job added to history.")144 self.logdebug("Job added to history.") 142 145 143 146 # exports some new environment variables … … 155 158 else : 156 159 printer.addJobToHistory(self.jobid, user, self.accounter.getLastPageCounter(), action, filename=self.preserveinputfile, title=self.title, copies=self.copies, options=self.options, clienthost=clienthost, jobsizebytes=self.jobSizeBytes) 157 self. sendBackChannelData("Job added to history during first pass : Job's size and price are still unknown.")160 self.logdebug("Job added to history during first pass : Job's size and price are still unknown.") 158 161 159 162 if action == "DENY" : … … 168 171 # in second pass, so all work is already done, 169 172 # now we just have to exit successfully 170 self.printInfo( "Software accounting already done in first pass. Exiting.")173 self.printInfo(_("Software accounting already done in first pass. Exiting.")) 171 174 else : 172 175 # Now we have to check if accounting was completely finished : … … 174 177 # accounting, only the second pass can know the job's size. 175 178 if (printer.LastJob.JobSize is not None) : 176 raise PyKotaToolError, "Hardware accounting already finished ! This should be impossible, please report this problem ASAP."179 raise PyKotaToolError, _("Hardware accounting already finished ! This should be impossible, please report this problem ASAP.") 177 180 178 181 # indicate phase change … … 181 184 # stops accounting. 182 185 self.accounter.endJob(userpquota) 183 self. sendBackChannelData("Job accounting ends.")186 self.logdebug("Job accounting ends.") 184 187 185 188 # retrieve the job size 186 189 jobsize = self.accounter.getJobSize() 187 self. sendBackChannelData("Job size : %i" % jobsize)190 self.logdebug("Job size : %i" % jobsize) 188 191 raise PyKotaToolError, "Not implemented !" 189 192 return self.acceptJob()