Changeset 1820
- Timestamp:
- 10/13/04 22:51:27 (20 years ago)
- Location:
- pykota/trunk
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/cupspykota
r1819 r1820 24 24 # 25 25 # $Log$ 26 # Revision 1.74 2004/10/13 20:51:27 jalet 27 # Made debugging levels be the same in cupspykota and lprngpykota. 28 # Now outputs more information in informational messages : user, printer, jobid 29 # 26 30 # Revision 1.73 2004/10/13 16:56:45 jalet 27 31 # Added a space to the pattern to differentiate jobs which id begins with … … 410 414 # we deny the job in this case (nothing to print anyway) 411 415 if not self.jobSizeBytes : 412 self.print Info(_("Job contains no data. Printing is denied."), "warn")416 self.printMoreInfo(user, printer, _("Job contains no data. Printing is denied."), "warn") 413 417 action = "DENY" 414 418 else : … … 422 426 self.prehook(userpquota) 423 427 424 self.print Info(_("Job accounting begins."))428 self.printMoreInfo(user, printer, _("Job accounting begins.")) 425 429 self.accounter.beginJob(printer) 426 430 else : … … 443 447 # stops accounting. 444 448 self.accounter.endJob(printer) 445 self.print Info(_("Job accounting ends."))449 self.printMoreInfo(user, printer, _("Job accounting ends.")) 446 450 447 451 # retrieve the job size 448 452 if action == "DENY" : 449 453 jobsize = 0 450 self.print Info(_("Job size forced to 0 because printing is denied."))454 self.printMoreInfo(user, printer, _("Job size forced to 0 because printing is denied.")) 451 455 else : 452 456 jobsize = self.accounter.getJobSize(printer) 453 self.print Info(_("Job size : %i") % jobsize)457 self.printMoreInfo(user, printer, _("Job size : %i") % jobsize) 454 458 455 459 # update the quota for the current user on this printer … … 459 463 # adds the current job to history 460 464 printer.addJobToHistory(self.jobid, user, self.accounter.getLastPageCounter(), action, jobsize, jobprice, self.preserveinputfile, self.title, self.copies, self.options, clienthost, self.jobSizeBytes) 461 self.print Info(_("Job added to history."))465 self.printMoreInfo(user, printer, _("Job added to history.")) 462 466 463 467 # exports some new environment variables -
pykota/trunk/bin/lprngpykota
r1713 r1820 24 24 # 25 25 # $Log$ 26 # Revision 1.8 2004/10/13 20:51:27 jalet 27 # Made debugging levels be the same in cupspykota and lprngpykota. 28 # Now outputs more information in informational messages : user, printer, jobid 29 # 26 30 # Revision 1.7 2004/09/13 16:02:44 jalet 27 31 # Added fix for incorrect job's size when hardware accounting fails … … 126 130 # we deny the job in this case (nothing to print anyway) 127 131 if not self.jobSizeBytes : 128 self.print Info(_("Job contains no data. Printing is denied."), "warn")132 self.printMoreInfo(user, printer, _("Job contains no data. Printing is denied."), "warn") 129 133 action = "DENY" 130 134 else : … … 138 142 self.prehook(userpquota) 139 143 140 self. logdebug("Job accounting begins.")144 self.printMoreInfo(user, printer, _("Job accounting begins.")) 141 145 self.accounter.beginJob(printer) 142 146 … … 145 149 self.accounter.endJob(printer) 146 150 jobsize = self.accounter.getJobSize(printer) 147 self. logdebug("Job accounting ends.")151 self.printMoreInfo(user, printer, _("Job accounting ends.")) 148 152 149 153 if action == "DENY" : 150 154 jobsize = 0 151 self. logdebug("Job size forced to 0 because printing was denied.")155 self.printMoreInfo(user, printer, _("Job size forced to 0 because printing is denied.")) 152 156 153 157 if (self.accounter.isSoftware) or (action == "DENY") : 154 158 # update the quota for the current user on this printer 155 self. logdebug("Job size : %i"% jobsize)159 self.printMoreInfo(user, printer, _("Job size : %i") % jobsize) 156 160 self.logdebug("Updating user %s's quota on printer %s" % (user.Name, printer.Name)) 157 161 jobprice = userpquota.increasePagesUsage(jobsize) 158 162 159 163 printer.addJobToHistory(self.jobid, user, self.accounter.getLastPageCounter(), action, jobsize, jobprice, self.preserveinputfile, self.title, self.copies, self.options, clienthost, self.jobSizeBytes) 160 self. logdebug("Job added to history.")164 self.printMoreInfo(user, printer, _("Job added to history.")) 161 165 162 166 # exports some new environment variables … … 189 193 # in second pass, so all work is already done, 190 194 # now we just have to exit successfully 191 self.print Info(_("Software accounting already done in first pass. Ignoring."))195 self.printMoreInfo(user, printer, _("Software accounting already done in first pass. Ignoring.")) 192 196 elif printer.LastJob.JobAction == "DENY" : 193 197 # Hardware accounting method was used, but job 194 198 # was rejected during first pass, so nothing to do 195 self.print Info(_("Hardware accounting already done in first pass. Ignoring."))199 self.printMoreInfo(user, printer, _("Hardware accounting already done in first pass. Ignoring.")) 196 200 else : 197 201 # here if user and userpquota are both None … … 221 225 jobsize = self.accounter.getJobSize(printer) 222 226 223 self. logdebug("Job size : %i"% jobsize)224 self. logdebug("Updating user %s's quota on printer %s"% (user.Name, printer.Name))227 self.printMoreInfo(user, printer, _("Job size : %i") % jobsize) 228 self.printInfo(_("Updating user %s's quota on printer %s") % (user.Name, printer.Name)) 225 229 jobprice = userpquota.increasePagesUsage(jobsize) 226 230 227 231 self.storage.writeLastJobSize(printer.LastJob, jobsize, jobprice) 228 self. logdebug("Job size and price now set in history.")232 self.printMoreInfo(user, printer, _("Job size and price now set in history.")) 229 233 230 234 # exports some new environment variables -
pykota/trunk/pykota/tool.py
r1803 r1820 22 22 # 23 23 # $Log$ 24 # Revision 1.129 2004/10/13 20:51:27 jalet 25 # Made debugging levels be the same in cupspykota and lprngpykota. 26 # Now outputs more information in informational messages : user, printer, jobid 27 # 24 28 # Revision 1.128 2004/10/11 22:53:06 jalet 25 29 # Postponed string interpolation to help message's output method … … 1155 1159 self.logger.log_message("%s" % message, level) 1156 1160 1161 def printMoreInfo(self, user, printer, message, level="info") : 1162 """Prefixes the information printed with 'user@printer(jobid) =>'.""" 1163 self.printInfo("%s@%s(%s) => %s" % (user.Name, printer.Name, self.jobid, message), level) 1164 1157 1165 def extractInfoFromCupsOrLprng(self) : 1158 1166 """Returns a tuple (printingsystem, printerhostname, printername, username, jobid, filename, title, options, backend).