Changeset 1609

Show
Ignore:
Timestamp:
07/21/04 00:47:38 (20 years ago)
Author:
jalet
Message:

Sanitizing

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/lprngpykota

    r1601 r1609  
    2424# 
    2525# $Log$ 
     26# Revision 1.2  2004/07/20 22:47:38  jalet 
     27# Sanitizing 
     28# 
    2629# Revision 1.1  2004/07/17 20:37:27  jalet 
    2730# Missing file... Am I really stupid ? 
     
    99102                    self.softwareJobSize = self.precomputeJobSize() 
    100103                    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)) 
    102105                os.environ["PYKOTAPRECOMPUTEDJOBSIZE"] = str(self.softwareJobSize) 
    103106                os.environ["PYKOTAPRECOMPUTEDJOBPRICE"] = str(self.softwareJobPrice) 
    104                  
    105                 # checks the user's quota 
    106                 action = self.warnUserPQuota(userpquota) 
    107107                 
    108108                # if no data to pass to real backend, probably a filter 
     
    112112                    self.printInfo(_("Job contains no data. Printing is denied."), "warn") 
    113113                    action = "DENY" 
     114                else :     
     115                    # checks the user's quota 
     116                    action = self.warnUserPQuota(userpquota) 
    114117                 
    115118                # exports some new environment variables 
     
    119122                self.prehook(userpquota) 
    120123                 
    121                 self.sendBackChannelData("Job accounting begins.") 
     124                self.logdebug("Job accounting begins.") 
    122125                self.accounter.beginJob(userpquota) 
    123126                 
     
    126129                    self.accounter.endJob(userpquota) 
    127130                    jobsize = self.accounter.getJobSize() 
    128                     self.sendBackChannelData("Job accounting ends.") 
     131                    self.logdebug("Job accounting ends.") 
    129132                     
    130133                if action == "DENY" :    
    131134                    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.") 
    133136                     
    134137                if jobsize is not None :     
    135138                    # 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)) 
    138141                    jobprice = userpquota.increasePagesUsage(jobsize) 
    139142                     
    140143                    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.") 
    142145                     
    143146                    # exports some new environment variables 
     
    155158                else : 
    156159                    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.") 
    158161                     
    159162                if action == "DENY" : 
     
    168171                    # in second pass, so all work is already done,  
    169172                    # 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.")) 
    171174                else :     
    172175                    # Now we have to check if accounting was completely finished : 
     
    174177                    # accounting, only the second pass can know the job's size. 
    175178                    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.") 
    177180                         
    178181                    # indicate phase change 
     
    181184                    # stops accounting.  
    182185                    self.accounter.endJob(userpquota) 
    183                     self.sendBackChannelData("Job accounting ends.") 
     186                    self.logdebug("Job accounting ends.") 
    184187                         
    185188                    # retrieve the job size     
    186189                    jobsize = self.accounter.getJobSize() 
    187                     self.sendBackChannelData("Job size : %i" % jobsize) 
     190                    self.logdebug("Job size : %i" % jobsize) 
    188191                    raise PyKotaToolError, "Not implemented !" 
    189192                return self.acceptJob()