Changeset 1529

Show
Ignore:
Timestamp:
06/08/04 00:45:35 (20 years ago)
Author:
jalet
Message:

Now accepts a job when enforcement is STRICT and predicted account balance
is equal to 0.0 : since the job hasn't been printed yet, only its printing
will really render balance equal to 0.0, so we should be allowed to print.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/tool.py

    r1523 r1529  
    2222# 
    2323# $Log$ 
     24# Revision 1.97  2004/06/07 22:45:35  jalet 
     25# Now accepts a job when enforcement is STRICT and predicted account balance 
     26# is equal to 0.0 : since the job hasn't been printed yet, only its printing 
     27# will really render balance equal to 0.0, so we should be allowed to print. 
     28# 
    2429# Revision 1.96  2004/06/05 22:18:04  jalet 
    2530# Now catches some exceptions earlier. 
     
    634639            else :     
    635640                action = "ALLOW" 
     641            if (enforcement == "STRICT") and (val == 0.0) : 
     642                action = "WARN" # we can still print until account is 0 
    636643        else : 
    637644            val = grouppquota.PageCounter 
     
    708715            else :     
    709716                val = float(user.AccountBalance or 0.0) 
    710                 if self.config.getPrinterEnforcement(printer.Name) == "STRICT" :  
     717                enforcement = self.config.getPrinterEnforcement(printer.Name) 
     718                if enforcement == "STRICT" :  
    711719                    val -= self.softwareJobPrice # use precomputed size. 
    712720                if val <= 0.0 : 
    713                     return "DENY" 
     721                    action = "DENY" 
    714722                elif val <= self.config.getPoorMan() :     
    715                     return "WARN" 
    716                 else :     
    717                     return "ALLOW" 
     723                    action = "WARN" 
     724                else : 
     725                    action = "ALLOW" 
     726                if (enforcement == "STRICT") and (val == 0.0) : 
     727                    action = "WARN" # we can still print until account is 0 
     728                return action     
    718729        else : 
    719730            # Then check the user quota on current printer and all its parents.