Changeset 1820 for pykota/trunk

Show
Ignore:
Timestamp:
10/13/04 22:51:27 (20 years ago)
Author:
jalet
Message:

Made debugging levels be the same in cupspykota and lprngpykota.
Now outputs more information in informational messages : user, printer, jobid

Location:
pykota/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/cupspykota

    r1819 r1820  
    2424# 
    2525# $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# 
    2630# Revision 1.73  2004/10/13 16:56:45  jalet 
    2731# Added a space to the pattern to differentiate jobs which id begins with 
     
    410414            # we deny the job in this case (nothing to print anyway) 
    411415            if not self.jobSizeBytes : 
    412                 self.printInfo(_("Job contains no data. Printing is denied."), "warn") 
     416                self.printMoreInfo(user, printer, _("Job contains no data. Printing is denied."), "warn") 
    413417                action = "DENY" 
    414418            else :     
     
    422426            self.prehook(userpquota) 
    423427             
    424             self.printInfo(_("Job accounting begins.")) 
     428            self.printMoreInfo(user, printer, _("Job accounting begins.")) 
    425429            self.accounter.beginJob(printer) 
    426430        else :     
     
    443447            # stops accounting.  
    444448            self.accounter.endJob(printer) 
    445             self.printInfo(_("Job accounting ends.")) 
     449            self.printMoreInfo(user, printer, _("Job accounting ends.")) 
    446450                 
    447451            # retrieve the job size     
    448452            if action == "DENY" : 
    449453                jobsize = 0 
    450                 self.printInfo(_("Job size forced to 0 because printing is denied.")) 
     454                self.printMoreInfo(user, printer, _("Job size forced to 0 because printing is denied.")) 
    451455            else :     
    452456                jobsize = self.accounter.getJobSize(printer) 
    453             self.printInfo(_("Job size : %i") % jobsize) 
     457            self.printMoreInfo(user, printer, _("Job size : %i") % jobsize) 
    454458             
    455459            # update the quota for the current user on this printer  
     
    459463            # adds the current job to history     
    460464            printer.addJobToHistory(self.jobid, user, self.accounter.getLastPageCounter(), action, jobsize, jobprice, self.preserveinputfile, self.title, self.copies, self.options, clienthost, self.jobSizeBytes) 
    461             self.printInfo(_("Job added to history.")) 
     465            self.printMoreInfo(user, printer, _("Job added to history.")) 
    462466             
    463467            # exports some new environment variables 
  • pykota/trunk/bin/lprngpykota

    r1713 r1820  
    2424# 
    2525# $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# 
    2630# Revision 1.7  2004/09/13 16:02:44  jalet 
    2731# Added fix for incorrect job's size when hardware accounting fails 
     
    126130        # we deny the job in this case (nothing to print anyway) 
    127131        if not self.jobSizeBytes : 
    128             self.printInfo(_("Job contains no data. Printing is denied."), "warn") 
     132            self.printMoreInfo(user, printer, _("Job contains no data. Printing is denied."), "warn") 
    129133            action = "DENY" 
    130134        else :     
     
    138142        self.prehook(userpquota) 
    139143         
    140         self.logdebug("Job accounting begins.") 
     144        self.printMoreInfo(user, printer, _("Job accounting begins.")) 
    141145        self.accounter.beginJob(printer) 
    142146         
     
    145149            self.accounter.endJob(printer) 
    146150            jobsize = self.accounter.getJobSize(printer) 
    147             self.logdebug("Job accounting ends.") 
     151            self.printMoreInfo(user, printer, _("Job accounting ends.")) 
    148152             
    149153        if action == "DENY" :    
    150154            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.")) 
    152156             
    153157        if (self.accounter.isSoftware) or (action == "DENY") :     
    154158            # 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) 
    156160            self.logdebug("Updating user %s's quota on printer %s" % (user.Name, printer.Name)) 
    157161            jobprice = userpquota.increasePagesUsage(jobsize) 
    158162             
    159163            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.")) 
    161165             
    162166            # exports some new environment variables 
     
    189193            # in second pass, so all work is already done,  
    190194            # now we just have to exit successfully 
    191             self.printInfo(_("Software accounting already done in first pass. Ignoring.")) 
     195            self.printMoreInfo(user, printer, _("Software accounting already done in first pass. Ignoring.")) 
    192196        elif printer.LastJob.JobAction == "DENY" : 
    193197            # Hardware accounting method was used, but job 
    194198            # was rejected during first pass, so nothing to do 
    195             self.printInfo(_("Hardware accounting already done in first pass. Ignoring.")) 
     199            self.printMoreInfo(user, printer, _("Hardware accounting already done in first pass. Ignoring.")) 
    196200        else :     
    197201            # here if user and userpquota are both None 
     
    221225            jobsize = self.accounter.getJobSize(printer) 
    222226             
    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)) 
    225229            jobprice = userpquota.increasePagesUsage(jobsize) 
    226230             
    227231            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.")) 
    229233             
    230234            # exports some new environment variables 
  • pykota/trunk/pykota/tool.py

    r1803 r1820  
    2222# 
    2323# $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# 
    2428# Revision 1.128  2004/10/11 22:53:06  jalet 
    2529# Postponed string interpolation to help message's output method 
     
    11551159        self.logger.log_message("%s" % message, level) 
    11561160         
     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         
    11571165    def extractInfoFromCupsOrLprng(self) :     
    11581166        """Returns a tuple (printingsystem, printerhostname, printername, username, jobid, filename, title, options, backend).