Show
Ignore:
Timestamp:
04/30/03 15:36:40 (21 years ago)
Author:
jalet
Message:

Stupid accounting method was added.

Files:
1 modified

Legend:

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

    r973 r976  
    2121# 
    2222# $Log$ 
     23# Revision 1.2  2003/04/30 13:36:40  jalet 
     24# Stupid accounting method was added. 
     25# 
    2326# Revision 1.1  2003/04/29 18:37:54  jalet 
    2427# Pluggable accounting methods (actually doesn't support external scripts) 
     
    2629# 
    2730# 
     31 
     32import sys 
    2833 
    2934class PyKotaAccounterError(Exception): 
     
    4247        self.filter = kotafilter 
    4348         
     49    def filterInput(self, inputfile) : 
     50        """Transparent filter.""" 
     51        mustclose = 0     
     52        if inputfile is not None :     
     53            if hasattr(inputfile, "read") : 
     54                infile = inputfile 
     55            else :     
     56                infile = open(inputfile, "rb") 
     57            mustclose = 1 
     58        else :     
     59            infile = sys.stdin 
     60        data = infile.read(256*1024)     
     61        while data : 
     62            sys.stdout.write(data) 
     63            data = infile.read(256*1024) 
     64        if mustclose :     
     65            infile.close() 
     66             
    4467    def doAccounting(self, printerid, userid) :     
    4568        """Does the real accounting."""