Show
Ignore:
Timestamp:
09/27/08 22:02:37 (16 years ago)
Author:
jerome
Message:

Removed unnecessary spaces at EOL.

Files:
1 modified

Legend:

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

    r3411 r3413  
    88# the Free Software Foundation, either version 3 of the License, or 
    99# (at your option) any later version. 
    10 #  
     10# 
    1111# This program is distributed in the hope that it will be useful, 
    1212# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1313# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414# GNU General Public License for more details. 
    15 #  
     15# 
    1616# You should have received a copy of the GNU General Public License 
    1717# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     
    2929from pykota.errors import PyKotaAccounterError 
    3030 
    31 class AccounterBase :     
     31class AccounterBase : 
    3232    """A class to account print usage by querying printers.""" 
    3333    def __init__(self, kotafilter, arguments, ispreaccounter=0, name="Unknown") : 
     
    3838        self.onerror = self.filter.config.getPrinterOnAccounterError(self.filter.PrinterName) 
    3939        self.isSoftware = 1 # by default software accounting 
    40         self.isPreAccounter = ispreaccounter  
     40        self.isPreAccounter = ispreaccounter 
    4141        self.inkUsage = [] 
    42          
    43     def getLastPageCounter(self) :     
     42 
     43    def getLastPageCounter(self) : 
    4444        """Returns last internal page counter value (possibly faked).""" 
    4545        try : 
    4646            return self.LastPageCounter or 0 
    47         except :     
     47        except : 
    4848            return 0 
    49              
    50     def beginJob(self, printer) :     
     49 
     50    def beginJob(self, printer) : 
    5151        """Saves the computed job size.""" 
    5252        # computes job's size 
    5353        self.JobSize = self.computeJobSize() 
    54          
     54 
    5555        # get last job information for this printer 
    5656        if not self.isPreAccounter : 
     
    5959                # The printer hasn't been used yet, from PyKota's point of view 
    6060                self.LastPageCounter = 0 
    61             else :     
     61            else : 
    6262                # get last job size and page counter from Quota Storage 
    63                 # Last lifetime page counter before actual job is  
     63                # Last lifetime page counter before actual job is 
    6464                # last page counter + last job size 
    6565                self.LastPageCounter = int(printer.LastJob.PrinterPageCounter or 0) + int(printer.LastJob.JobSize or 0) 
    66          
    67     def fakeBeginJob(self) :     
     66 
     67    def fakeBeginJob(self) : 
    6868        """Do nothing.""" 
    6969        pass 
    70          
    71     def endJob(self, printer) :     
     70 
     71    def endJob(self, printer) : 
    7272        """Do nothing.""" 
    7373        pass 
    74          
    75     def getJobSize(self, printer) :     
     74 
     75    def getJobSize(self, printer) : 
    7676        """Returns the actual job size.""" 
    7777        try : 
    7878            return self.JobSize 
    79         except AttributeError :     
     79        except AttributeError : 
    8080            return 0 
    81          
    82     def computeJobSize(self) :     
     81 
     82    def computeJobSize(self) : 
    8383        """Must be overriden in children classes.""" 
    8484        raise RuntimeError, "AccounterBase.computeJobSize() must be overriden !" 
    85          
     85 
    8686def openAccounter(kotafilter, ispreaccounter=0) : 
    8787    """Returns a connection handle to the appropriate accounter.""" 
     
    9191        (backend, args) = kotafilter.config.getAccounterBackend(kotafilter.PrinterName) 
    9292    try : 
    93         accounterbackend = imp.load_source("accounterbackend",  
     93        accounterbackend = imp.load_source("accounterbackend", 
    9494                                            os.path.join(os.path.dirname(__file__), 
    9595                                                         "accounters", 
     
    9797    except ImportError : 
    9898        raise PyKotaAccounterError, _("Unsupported accounter backend %s") % backend 
    99     else :     
     99    else : 
    100100        return accounterbackend.Accounter(kotafilter, args, ispreaccounter, backend.lower())