Changeset 1629 for pykota/trunk/bin

Show
Ignore:
Timestamp:
07/23/04 13:19:48 (20 years ago)
Author:
jalet
Message:

1.19beta is out !

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/lprngpykota

    r1624 r1629  
    2424# 
    2525# $Log$ 
     26# Revision 1.5  2004/07/23 11:19:48  jalet 
     27# 1.19beta is out ! 
     28# 
    2629# Revision 1.4  2004/07/22 22:41:48  jalet 
    2730# Hardware accounting for LPRng should be OK now. UNTESTED. 
     
    8285        """First pass done here.""" 
    8386        # first we have to check if previous job was correctly accounted for 
    84         if (printer.LastJob.JobAction != "DENY") and (printer.LastJob.JobSize is None) : 
     87        if printer.LastJob.Exists and not printer.LastJob.JobSize : 
    8588            # here we know that previous job wasn't accounted for correctly 
    8689            # we are sure (?) that it was hardware accounting which was used 
     
    139142            self.logdebug("Job size forced to 0 because printing was denied.") 
    140143             
    141         if self.accounter.isSoftware :     
     144        if (self.accounter.isSoftware) or (action == "DENY") :     
    142145            # update the quota for the current user on this printer  
    143146            self.logdebug("Job size : %i" % jobsize) 
     
    159162            self.posthook(userpquota) 
    160163             
    161             # here software accounting was completed. 
     164            # here accounting was completed, either software, or hardware but over quota 
    162165        else : 
    163166            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) 
     
    177180            # in second pass, so all work is already done,  
    178181            # now we just have to exit successfully 
    179             self.printInfo(_("Software accounting already done in first pass. Exiting.")) 
    180         else :     
    181             # Now we have to check if accounting was completely finished : 
    182             # if it is, then a big problem occured because with hardware 
    183             # accounting, only the second pass can know the job's size. 
    184             if (printer.LastJob.JobSize is not None) : 
    185                 # this could only occur if configuration was modified  
    186                 # between first and second pass, and accounter changed 
    187                 # from software to hardware during this short (?) time. 
    188                 raise PyKotaToolError, _("Hardware accounting already finished ! This should be impossible, please report this problem ASAP.") 
    189                  
     182            self.printInfo(_("Software accounting already done in first pass. Ignoring.")) 
     183        elif printer.LastJob.JobAction == "DENY" : 
     184            # Hardware accounting method was used, but job 
     185            # was rejected during first pass, so nothing to do 
     186            self.printInfo(_("Hardware accounting already done in first pass. Ignoring.")) 
     187        else :     
    190188            # here if user and userpquota are both None 
    191189            # then it's a special second pass for a job