Changeset 740 for pykota/trunk

Show
Ignore:
Timestamp:
02/07/03 11:23:48 (22 years ago)
Author:
jalet
Message:

Avoid a possible future name clash

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/pykota

    r728 r740  
    1717# 
    1818# $Log$ 
     19# Revision 1.7  2003/02/07 10:23:48  jalet 
     20# Avoid a possible future name clash 
     21# 
    1922# Revision 1.6  2003/02/06 22:54:33  jalet 
    2023# warnpykota should be ok 
     
    99102     
    100103    # Initializes the current tool 
    101     tool = PyKotaFilter(username)     
     104    kotafilter = PyKotaFilter(username)     
    102105     
    103106    # Get the page counter directly from the printer itself 
    104     counterbeforejob = tool.requester.getPrinterPageCounter(tool.printerhostname) # TODO use printername instead, make them match from CUPS' config files 
     107    counterbeforejob = kotafilter.requester.getPrinterPageCounter(kotafilter.printerhostname) # TODO use printername instead, make them match from CUPS' config files 
    105108     
    106109    # Get the last page counter and last username from the Quota Storage backend 
    107     pgc = tool.storage.getPrinterPageCounter(tool.printername)     
     110    pgc = kotafilter.storage.getPrinterPageCounter(kotafilter.printername)     
    108111    if pgc is None : 
    109112        # The printer is unknown from the Quota Storage perspective 
    110113        # we let the job pass through, but log a warning message 
    111         tool.logger.log_message("Printer %s not registered in the PyKota system" % tool.printername, "warn") 
     114        kotafilter.logger.log_message("Printer %s not registered in the PyKota system" % kotafilter.printername, "warn") 
    112115    else :     
    113116        (lastpagecounter, lastusername) = (pgc["pagecounter"], pgc["lastusername"]) 
     
    115118        # Update the last page counter and last username in the Quota Storage backend 
    116119        # set them to current user and  
    117         tool.storage.updatePrinterPageCounter(tool.printername, username, counterbeforejob) # TODO : allow or deny users not in quota system, and die cleanly if needed 
     120        kotafilter.storage.updatePrinterPageCounter(kotafilter.printername, username, counterbeforejob) # TODO : allow or deny users not in quota system, and die cleanly if needed 
    118121         
    119122        # Is the current user allowed to print at all ? 
    120         action = tool.warnUserPQuota(username) 
     123        action = kotafilter.warnUserPQuota(username) 
    121124        if action == "DENY" : 
    122125            # No, just die cleanly 
     
    129132        jobsize = (counterbeforejob - lastpagecounter)     
    130133        if jobsize >= 0: 
    131             tool.storage.updateUserPQuota(lastusername, tool.printername, jobsize) 
    132             tool.warnUserPQuota(lastusername) 
     134            kotafilter.storage.updateUserPQuota(lastusername, kotafilter.printername, jobsize) 
     135            kotafilter.warnUserPQuota(lastusername) 
    133136        else :     
    134             tool.logger.log_message("Error in page count value %i for user %s on printer %s" % (jobsize, tool.printername, lastusername), "error") 
     137            kotafilter.logger.log_message("Error in page count value %i for user %s on printer %s" % (jobsize, kotafilter.printername, lastusername), "error") 
    135138         
    136139    # pass the job untouched to the underlying layer 
    137     tool.filterInput(inputfile)       
     140    kotafilter.filterInput(inputfile)       
    138141     
    139142    return 0