Index: /pykota/trunk/bin/lprngpykota
===================================================================
--- /pykota/trunk/bin/lprngpykota (revision 1601)
+++ /pykota/trunk/bin/lprngpykota (revision 1609)
@@ -24,4 +24,7 @@
 #
 # $Log$
+# Revision 1.2  2004/07/20 22:47:38  jalet
+# Sanitizing
+#
 # Revision 1.1  2004/07/17 20:37:27  jalet
 # Missing file... Am I really stupid ?
@@ -99,10 +102,7 @@
                     self.softwareJobSize = self.precomputeJobSize()
                     self.softwareJobPrice = userpquota.computeJobPrice(self.softwareJobSize)
-                    self.sendBackChannelData("Precomputed job's size is %s pages, price is %s units" % (self.softwareJobSize, self.softwareJobPrice))
+                    self.logdebug("Precomputed job's size is %s pages, price is %s units" % (self.softwareJobSize, self.softwareJobPrice))
                 os.environ["PYKOTAPRECOMPUTEDJOBSIZE"] = str(self.softwareJobSize)
                 os.environ["PYKOTAPRECOMPUTEDJOBPRICE"] = str(self.softwareJobPrice)
-                
-                # checks the user's quota
-                action = self.warnUserPQuota(userpquota)
                 
                 # if no data to pass to real backend, probably a filter
@@ -112,4 +112,7 @@
                     self.printInfo(_("Job contains no data. Printing is denied."), "warn")
                     action = "DENY"
+                else :    
+                    # checks the user's quota
+                    action = self.warnUserPQuota(userpquota)
                 
                 # exports some new environment variables
@@ -119,5 +122,5 @@
                 self.prehook(userpquota)
                 
-                self.sendBackChannelData("Job accounting begins.")
+                self.logdebug("Job accounting begins.")
                 self.accounter.beginJob(userpquota)
                 
@@ -126,18 +129,18 @@
                     self.accounter.endJob(userpquota)
                     jobsize = self.accounter.getJobSize()
-                    self.sendBackChannelData("Job accounting ends.")
+                    self.logdebug("Job accounting ends.")
                     
                 if action == "DENY" :   
                     jobsize = 0
-                    self.sendBackChannelData("Job size forced to 0 because printing was denied.")
+                    self.logdebug("Job size forced to 0 because printing was denied.")
                     
                 if jobsize is not None :    
                     # update the quota for the current user on this printer 
-                    self.sendBackChannelData("Job size : %i" % jobsize)
-                    self.sendBackChannelData("Updating user %s's quota on printer %s" % (user.Name, printer.Name))
+                    self.logdebug("Job size : %i" % jobsize)
+                    self.logdebug("Updating user %s's quota on printer %s" % (user.Name, printer.Name))
                     jobprice = userpquota.increasePagesUsage(jobsize)
                     
                     printer.addJobToHistory(self.jobid, user, self.accounter.getLastPageCounter(), action, jobsize, jobprice, self.preserveinputfile, self.title, self.copies, self.options, clienthost, self.jobSizeBytes)
-                    self.sendBackChannelData("Job added to history.")
+                    self.logdebug("Job added to history.")
                     
                     # exports some new environment variables
@@ -155,5 +158,5 @@
                 else :
                     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)
-                    self.sendBackChannelData("Job added to history during first pass : Job's size and price are still unknown.")
+                    self.logdebug("Job added to history during first pass : Job's size and price are still unknown.")
                     
                 if action == "DENY" :
@@ -168,5 +171,5 @@
                     # in second pass, so all work is already done, 
                     # now we just have to exit successfully
-                    self.printInfo("Software accounting already done in first pass. Exiting.")
+                    self.printInfo(_("Software accounting already done in first pass. Exiting."))
                 else :    
                     # Now we have to check if accounting was completely finished :
@@ -174,5 +177,5 @@
                     # accounting, only the second pass can know the job's size.
                     if (printer.LastJob.JobSize is not None) :
-                        raise PyKotaToolError, "Hardware accounting already finished ! This should be impossible, please report this problem ASAP."
+                        raise PyKotaToolError, _("Hardware accounting already finished ! This should be impossible, please report this problem ASAP.")
                         
                     # indicate phase change
@@ -181,9 +184,9 @@
                     # stops accounting. 
                     self.accounter.endJob(userpquota)
-                    self.sendBackChannelData("Job accounting ends.")
+                    self.logdebug("Job accounting ends.")
                         
                     # retrieve the job size    
                     jobsize = self.accounter.getJobSize()
-                    self.sendBackChannelData("Job size : %i" % jobsize)
+                    self.logdebug("Job size : %i" % jobsize)
                     raise PyKotaToolError, "Not implemented !"
                 return self.acceptJob()
