Changeset 1281

Show
Ignore:
Timestamp:
01/12/04 19:20:45 (20 years ago)
Author:
jalet
Message:

Denied jobs weren't added to the history anymore, this is now fixed.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/pykota

    r1271 r1281  
    2424# 
    2525# $Log$ 
     26# Revision 1.51  2004/01/12 18:20:45  jalet 
     27# Denied jobs weren't added to the history anymore, this is now fixed. 
     28# 
    2629# Revision 1.50  2004/01/11 23:22:42  jalet 
    2730# Major code refactoring, it's way cleaner, and now allows automated addition 
     
    243246            self.logdebug("Does accounting for user %s on printer %s." % (user.Name, printer.Name)) 
    244247            action = self.accounter.doAccounting(userpquota) 
    245             if action == "DENY" : 
    246                 # Just die. 
    247                 self.logdebug("Printing is denied.") 
    248                 return self.removeJob() 
     248        else :         
     249            action = "ALLOW" 
    249250             
    250251        # pass the job's data to the next filter 
    251         self.logdebug("Passing input data to next filter.") 
    252         mustclose = 0     
    253         if self.inputfile is not None :     
    254             if hasattr(self.inputfile, "read") : 
    255                 infile = self.inputfile 
     252        if action in ["ALLOW", "WARN"] : 
     253            self.logdebug("Passing input data to next filter.") 
     254            mustclose = 0     
     255            if self.inputfile is not None :     
     256                if hasattr(self.inputfile, "read") : 
     257                    infile = self.inputfile 
     258                else :     
     259                    infile = open(self.inputfile, "rb") 
     260                mustclose = 1 
    256261            else :     
    257                 infile = open(self.inputfile, "rb") 
    258             mustclose = 1 
    259         else :     
    260             infile = sys.stdin 
    261         data = infile.read(256*1024)     
    262         while data : 
    263             sys.stdout.write(data) 
    264             data = infile.read(256*1024) 
    265         if mustclose :     
    266             infile.close() 
    267          
    268         return self.acceptJob() 
     262                infile = sys.stdin 
     263            data = infile.read(256*1024)     
     264            while data : 
     265                sys.stdout.write(data) 
     266                data = infile.read(256*1024) 
     267            if mustclose :     
     268                infile.close() 
     269            return self.acceptJob() 
     270        else : 
     271            self.logdebug("Printing is denied.") 
     272            return self.removeJob() 
    269273         
    270274    def mainWork(self) :