Index: pykota/trunk/pykota/accounters/software.py
===================================================================
--- pykota/trunk/pykota/accounters/software.py (revision 3411)
+++ pykota/trunk/pykota/accounters/software.py (revision 3413)
@@ -8,10 +8,10 @@
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
@@ -30,5 +30,5 @@
 
 class Accounter(AccounterBase) :
-    def computeJobSize(self) :    
+    def computeJobSize(self) :
         """Feeds an external command with our datas to let it compute the job size, and return its value."""
         if (not self.isPreAccounter) and \
@@ -39,13 +39,13 @@
             self.filter.logdebug("Precomputing pass told us that job is %s pages long." % self.filter.softwareJobSize)
             return self.filter.softwareJobSize   # Optimize : already computed !
-            
+
         if self.arguments :
             self.filter.logdebug("Using external script %s to compute job's size." % self.arguments)
             return self.withExternalScript()
-        else :    
+        else :
             self.filter.logdebug("Using internal parser to compute job's size.")
             return self.withInternalParser()
-        
-    def withInternalParser(self) :    
+
+    def withInternalParser(self) :
         """Does software accounting through an external script."""
         jobsize = 0
@@ -53,12 +53,12 @@
             try :
                 from pkpgpdls import analyzer, pdlparser
-            except ImportError :    
+            except ImportError :
                 self.filter.printInfo("pkpgcounter is now distributed separately, please grab it from http://www.pykota.com/software/pkpgcounter", "error")
                 self.filter.printInfo("Precomputed job size will be forced to 0 pages.", "error")
-            else :     
+            else :
                 try :
                     parser = analyzer.PDLAnalyzer(self.filter.DataFile)
                     jobsize = parser.getJobSize()
-                except pdlparser.PDLParserError, msg :    
+                except pdlparser.PDLParserError, msg :
                     # Here we just log the failure, but
                     # we finally ignore it and return 0 since this
@@ -66,15 +66,15 @@
                     # job's size MAY be.
                     self.filter.printInfo(_("Unable to precompute the job's size with the generic PDL analyzer : %s") % msg, "warn")
-                else :    
+                else :
                     try :
                         if self.filter.Ticket.FileName is not None :
-                            # when a filename is passed as an argument, the backend 
+                            # when a filename is passed as an argument, the backend
                             # must generate the correct number of copies.
                             jobsize *= self.filter.Ticket.Copies
                     except AttributeError : # When not run from the cupspykota backend
                         pass
-        return jobsize        
-                
-    def withExternalScript(self) :    
+        return jobsize
+
+    def withExternalScript(self) :
         """Does software accounting through an external script."""
         self.filter.logdebug(_("Launching SOFTWARE(%s)...") % self.arguments)
@@ -83,26 +83,26 @@
         try :
             answer = child.read()
-        except (IOError, OSError), msg :    
-            msg = "%s : %s" % (self.arguments, msg) 
+        except (IOError, OSError), msg :
+            msg = "%s : %s" % (self.arguments, msg)
             self.filter.printInfo(_("Unable to compute job size with accounter %s") % msg, "warn")
-        else :    
+        else :
             lines = [l.strip() for l in answer.split("\n")]
-            for i in range(len(lines)) : 
+            for i in range(len(lines)) :
                 try :
                     pagecounter = int(lines[i])
                 except (AttributeError, ValueError) :
                     self.filter.logdebug(_("Line [%s] skipped in accounter's output. Trying again...") % lines[i])
-                else :    
+                else :
                     break
-                    
+
         status = child.close()
         try :
             if os.WIFEXITED(status) :
                 status = os.WEXITSTATUS(status)
-        except TypeError :        
+        except TypeError :
             pass # None means no error occured.
         self.filter.logdebug(_("Software accounter %s exit code is %s") % (self.arguments, str(status)))
-            
-        if pagecounter is None :    
+
+        if pagecounter is None :
             message = _("Unable to compute job size with accounter %s") % self.arguments
             if self.onerror == "CONTINUE" :
@@ -111,13 +111,13 @@
                 raise PyKotaAccounterError, message
         self.filter.logdebug("Software accounter %s said job is %s pages long." % (self.arguments, repr(pagecounter)))
-            
-        pagecounter = pagecounter or 0    
+
+        pagecounter = pagecounter or 0
         try :
             if self.filter.Ticket.FileName is not None :
-                # when a filename is passed as an argument, the backend 
+                # when a filename is passed as an argument, the backend
                 # must generate the correct number of copies.
                 pagecounter *= self.filter.Ticket.Copies
-        except AttributeError :        
+        except AttributeError :
             pass # when called from pykotme. TODO : clean this mess some day.
-                        
+
         return pagecounter
Index: pykota/trunk/pykota/accounters/hardware.py
===================================================================
--- pykota/trunk/pykota/accounters/hardware.py (revision 3411)
+++ pykota/trunk/pykota/accounters/hardware.py (revision 3413)
@@ -8,10 +8,10 @@
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
@@ -36,28 +36,28 @@
         AccounterBase.__init__(self, kotabackend, arguments, ispreaccounter, name)
         self.isSoftware = 0
-        
-    def getPrinterInternalPageCounter(self) :    
+
+    def getPrinterInternalPageCounter(self) :
         """Returns the printer's internal page counter."""
         self.filter.logdebug("Reading printer %s's internal page counter..." % self.filter.PrinterName)
         counter = self.askPrinterPageCounter(self.filter.PrinterHostName)
         self.filter.logdebug("Printer %s's internal page counter value is : %s" % (self.filter.PrinterName, str(counter)))
-        return counter    
-        
-    def beginJob(self, printer) :    
+        return counter
+
+    def beginJob(self, printer) :
         """Saves printer internal page counter at start of job."""
         # save page counter before job
         self.LastPageCounter = self.getPrinterInternalPageCounter()
         self.fakeBeginJob()
-        
-    def fakeBeginJob(self) :    
+
+    def fakeBeginJob(self) :
         """Fakes a begining of a job."""
         self.counterbefore = self.getLastPageCounter()
-        
-    def endJob(self, printer) :    
+
+    def endJob(self, printer) :
         """Saves printer internal page counter at end of job."""
         # save page counter after job
         self.LastPageCounter = self.counterafter = self.getPrinterInternalPageCounter()
-        
-    def getJobSize(self, printer) :    
+
+    def getJobSize(self, printer) :
         """Returns the actual job size."""
         if (not self.counterbefore) or (not self.counterafter) :
@@ -67,10 +67,10 @@
                 # if there's a previous job, use the last value from database
                 self.filter.printInfo(_("Retrieving printer %s's page counter from database instead.") % printer.Name, "warn")
-                if not self.counterbefore : 
+                if not self.counterbefore :
                     self.counterbefore = printer.LastJob.PrinterPageCounter or 0
                 if not self.counterafter :
                     self.counterafter = printer.LastJob.PrinterPageCounter or 0
-                before = min(self.counterbefore, self.counterafter)    
-                after = max(self.counterbefore, self.counterafter)    
+                before = min(self.counterbefore, self.counterafter)
+                after = max(self.counterbefore, self.counterafter)
                 self.counterbefore = before
                 self.counterafter = after
@@ -85,17 +85,17 @@
                 self.counterbefore = 0
                 self.counterafter = 1
-                
-        jobsize = (self.counterafter - self.counterbefore)    
+
+        jobsize = (self.counterafter - self.counterbefore)
         if jobsize < 0 :
-            # Try to take care of HP printers 
+            # Try to take care of HP printers
             # Their internal page counter is saved to NVRAM
             # only every 10 pages. If the printer was switched
             # off then back on during the job, and that the
-            # counters difference is negative, we know 
+            # counters difference is negative, we know
             # the formula (we can't know if more than eleven
             # pages were printed though) :
             if jobsize > -10 :
                 jobsize += 10
-            else :    
+            else :
                 # here we may have got a printer being replaced
                 # DURING the job. This is HIGHLY improbable (but already happened) !
@@ -104,8 +104,8 @@
                 jobsize = 1
         return jobsize
-        
+
     def askPrinterPageCounter(self, printer) :
         """Returns the page counter from the printer via an external command.
-        
+
            The external command must report the life time page number of the printer on stdout.
         """
@@ -117,41 +117,41 @@
         elif (cmdlower == "pjl") or cmdlower.startswith("pjl:") :
             return pjl.Handler(self, printer, skipinitialwait).retrieveInternalPageCounter()
-            
+
         if printer is None :
             raise PyKotaAccounterError, _("Unknown printer address in HARDWARE(%s) for printer %s") % (commandline, self.filter.PrinterName)
-        while 1 :    
+        while 1 :
             self.filter.printInfo(_("Launching HARDWARE(%s)...") % commandline)
             pagecounter = None
-            child = popen2.Popen4(commandline)    
+            child = popen2.Popen4(commandline)
             try :
                 answer = child.fromchild.read()
-            except IOError :    
+            except IOError :
                 # we were interrupted by a signal, certainely a SIGTERM
                 # caused by the user cancelling the current job
                 try :
                     os.kill(child.pid, signal.SIGTERM)
-                except :    
+                except :
                     pass # already killed ?
                 self.filter.printInfo(_("SIGTERM was sent to hardware accounter %s (pid: %s)") % (commandline, child.pid))
-            else :    
+            else :
                 lines = [l.strip() for l in answer.split("\n")]
-                for i in range(len(lines)) : 
+                for i in range(len(lines)) :
                     try :
                         pagecounter = int(lines[i])
                     except (AttributeError, ValueError) :
                         self.filter.printInfo(_("Line [%s] skipped in accounter's output. Trying again...") % lines[i])
-                    else :    
+                    else :
                         break
-            child.fromchild.close()    
+            child.fromchild.close()
             child.tochild.close()
             try :
                 status = child.wait()
-            except OSError, msg :    
+            except OSError, msg :
                 self.filter.logdebug("Error while waiting for hardware accounter pid %s : %s" % (child.pid, msg))
-            else :    
+            else :
                 if os.WIFEXITED(status) :
                     status = os.WEXITSTATUS(status)
                 self.filter.printInfo(_("Hardware accounter %s exit code is %s") % (self.arguments, str(status)))
-                
+
             if pagecounter is None :
                 message = _("Unable to query printer %s via HARDWARE(%s)") % (printer, commandline)
@@ -159,5 +159,5 @@
                     self.filter.printInfo(message, "error")
                 else :
-                    raise PyKotaAccounterError, message 
-            else :        
-                return pagecounter        
+                    raise PyKotaAccounterError, message
+            else :
+                return pagecounter
Index: pykota/trunk/pykota/accounters/snmp.py
===================================================================
--- pykota/trunk/pykota/accounters/snmp.py (revision 3411)
+++ pykota/trunk/pykota/accounters/snmp.py (revision 3413)
@@ -8,10 +8,10 @@
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
@@ -36,5 +36,5 @@
 try :
     from pysnmp.entity.rfc3413.oneliner import cmdgen
-except ImportError :    
+except ImportError :
     hasV4 = False
     try :
@@ -50,5 +50,5 @@
 from pykota import constants
 
-#                      
+#
 # Documentation taken from RFC 3805 (Printer MIB v2) and RFC 2790 (Host Resource MIB)
 #
@@ -67,5 +67,5 @@
                        4 : 'testing',
                        5 : 'down',
-                     }  
+                     }
 hrPrinterDetectedErrorStateOID = "1.3.6.1.2.1.25.3.5.1.2.1" # SNMPv2-SMI::mib-2.25.3.5.1.2.1
 printerDetectedErrorStateValues = [ { 128 : 'Low Paper',
@@ -87,6 +87,6 @@
                                         1 : 'Not Assigned in RFC3805',
                                     },
-                                  ]  
-                                  
+                                  ]
+
 # The default error mask to use when checking error conditions.
 defaultErrorMask = 0x4fcc # [ 'No Paper',
@@ -100,6 +100,6 @@
                           #   'Input Tray Empty',
                           # ]
-                          
-# WARNING : some printers don't support this one :                  
+
+# WARNING : some printers don't support this one :
 prtConsoleDisplayBufferTextOID = "1.3.6.1.2.1.43.16.5.1.2.1.1" # SNMPv2-SMI::mib-2.43.16.5.1.2.1.1
 class BaseHandler :
@@ -111,10 +111,10 @@
         try :
             self.community = self.parent.arguments.split(":")[1].strip()
-        except IndexError :    
+        except IndexError :
             self.community = "public"
         self.port = 161
         self.initValues()
-        
-    def initValues(self) :    
+
+    def initValues(self) :
         """Initializes SNMP values."""
         self.printerInternalPageCounter = None
@@ -123,10 +123,10 @@
         self.printerDetectedErrorState = None
         self.timebefore = time.time()   # resets timer also in case of error
-        
-    def retrieveSNMPValues(self) :    
+
+    def retrieveSNMPValues(self) :
         """Retrieves a printer's internal page counter and status via SNMP."""
         raise RuntimeError, "You have to overload this method."
-        
-    def extractErrorStates(self, value) :    
+
+    def extractErrorStates(self, value) :
         """Returns a list of textual error states from a binary value."""
         states = []
@@ -137,7 +137,7 @@
                 if byte & k :
                     states.append(v)
-        return states            
-        
-    def checkIfError(self, errorstates) :    
+        return states
+
+    def checkIfError(self, errorstates) :
         """Checks if any error state is fatal or not."""
         if errorstates is None :
@@ -146,5 +146,5 @@
             try :
                 errormask = self.parent.filter.config.getPrinterSNMPErrorMask(self.parent.filter.PrinterName)
-            except AttributeError : # debug mode    
+            except AttributeError : # debug mode
                 errormask = defaultErrorMask
             if errormask is None :
@@ -161,6 +161,6 @@
                     return True
             self.parent.filter.logdebug("No error condition matching mask 0x%04x" % errormask)
-            return False    
-        
+            return False
+
     def waitPrinting(self) :
         """Waits for printer status being 'printing'."""
@@ -169,5 +169,5 @@
         if not noprintingmaxdelay :
             self.parent.filter.logdebug("Will wait indefinitely until printer %s is in 'printing' state." % self.parent.filter.PrinterName)
-        else :    
+        else :
             self.parent.filter.logdebug("Will wait until printer %s is in 'printing' state or %i seconds have elapsed." % (self.parent.filter.PrinterName, noprintingmaxdelay))
         previousValue = self.parent.getLastPageCounter()
@@ -178,9 +178,9 @@
             if statusAsString in ('printing', 'warmup') :
                 break
-            if self.printerInternalPageCounter is not None :    
+            if self.printerInternalPageCounter is not None :
                 if firstvalue is None :
                     # first time we retrieved a page counter, save it
                     firstvalue = self.printerInternalPageCounter
-                else :     
+                else :
                     # second time (or later)
                     if firstvalue < self.printerInternalPageCounter :
@@ -205,12 +205,12 @@
                                 # the printer rejected it for some reason.
                                 self.parent.filter.printInfo("Printer %s probably won't print this job !!!" % self.parent.filter.PrinterName, "warn")
-                            else :     
+                            else :
                                 # Here the job has already been entirely printed, and
                                 # the printer has already passed from 'idle' to 'printing' to 'idle' again.
                                 self.parent.filter.printInfo("Printer %s has probably already printed this job !!!" % self.parent.filter.PrinterName, "warn")
                             break
-            self.parent.filter.logdebug(_("Waiting for printer %s to be printing...") % self.parent.filter.PrinterName)    
+            self.parent.filter.logdebug(_("Waiting for printer %s to be printing...") % self.parent.filter.PrinterName)
             time.sleep(statusstabilizationdelay)
-        
+
     def waitIdle(self) :
         """Waits for printer status being 'idle'."""
@@ -228,19 +228,19 @@
                           (dstatusAsString == 'running'))) :
                 idle_flag = 1       # Standby / Powersave is considered idle
-            if idle_flag :    
+            if idle_flag :
                 if (self.printerInternalPageCounter is not None) \
                    and self.skipinitialwait \
                    and (os.environ.get("PYKOTAPHASE") == "BEFORE") :
                     self.parent.filter.logdebug("No need to wait for the printer to be idle, it is the case already.")
-                    return 
+                    return
                 idle_num += 1
                 if idle_num >= statusstabilizationloops :
                     # printer status is stable, we can exit
                     break
-            else :    
+            else :
                 idle_num = 0
-            self.parent.filter.logdebug(_("Waiting for printer %s's idle status to stabilize...") % self.parent.filter.PrinterName)    
+            self.parent.filter.logdebug(_("Waiting for printer %s's idle status to stabilize...") % self.parent.filter.PrinterName)
             time.sleep(statusstabilizationdelay)
-            
+
     def retrieveInternalPageCounter(self) :
         """Returns the page counter from the printer via internal SNMP handling."""
@@ -251,11 +251,11 @@
                self.parent.filter.JobSizeBytes :
                 self.waitPrinting()
-            self.waitIdle()    
-        except :    
+            self.waitIdle()
+        except :
             self.parent.filter.printInfo(_("SNMP querying stage interrupted. Using latest value seen for internal page counter (%s) on printer %s.") % (self.printerInternalPageCounter, self.parent.filter.PrinterName), "warn")
             raise
         return self.printerInternalPageCounter
-            
-if hasV4 :            
+
+if hasV4 :
     class Handler(BaseHandler) :
         """A class for pysnmp v4.x"""
@@ -270,17 +270,17 @@
                                                   tuple([int(i) for i in hrDeviceStatusOID.split('.')]), \
                                                   tuple([int(i) for i in hrPrinterDetectedErrorStateOID.split('.')]))
-            except socket.gaierror, msg :                                      
+            except socket.gaierror, msg :
                 errorIndication = repr(msg)
-            except :                                      
+            except :
                 errorIndication = "Unknown SNMP/Network error. Check your wires."
-            if errorIndication :                                                  
+            if errorIndication :
                 self.parent.filter.printInfo("SNMP Error : %s" % errorIndication, "error")
                 self.initValues()
-            elif errorStatus :    
+            elif errorStatus :
                 self.parent.filter.printInfo("SNMP Error : %s at %s" % (errorStatus.prettyPrint(), \
                                                                         varBinds[int(errorIndex)-1]), \
                                              "error")
                 self.initValues()
-            else :                                 
+            else :
                 self.printerInternalPageCounter = max(self.printerInternalPageCounter, int(varBinds[0][1].prettyPrint() or "0"))
                 self.printerStatus = int(varBinds[1][1].prettyPrint())
@@ -295,5 +295,5 @@
     class Handler(BaseHandler) :
         """A class for pysnmp v3.4.x"""
-        def retrieveSNMPValues(self) :    
+        def retrieveSNMPValues(self) :
             """Retrieves a printer's internal page counter and status via SNMP."""
             ver = alpha.protoVersions[alpha.protoVersionId1]
@@ -310,9 +310,9 @@
                                    (self.printerHostname, self.port), \
                                    (self.handleAnswer, req))
-            except (SnmpOverUdpError, select.error), msg :    
+            except (SnmpOverUdpError, select.error), msg :
                 self.parent.filter.printInfo(_("Network error while doing SNMP queries on printer %s : %s") % (self.printerHostname, msg), "warn")
                 self.initValues()
             tsp.close()
-        
+
         def handleAnswer(self, wholeMsg, notusedhere, req):
             """Decodes and handles the SNMP answer."""
@@ -321,5 +321,5 @@
             try :
                 rsp.berDecode(wholeMsg)
-            except TypeMismatchError, msg :    
+            except TypeMismatchError, msg :
                 self.parent.filter.printInfo(_("SNMP message decoding error for printer %s : %s") % (self.printerHostname, msg), "warn")
                 self.initValues()
@@ -333,5 +333,5 @@
                         for varBind in rsp.apiAlphaGetPdu().apiAlphaGetVarBindList():
                             self.values.append(varBind.apiAlphaGetOidVal()[1].rawAsn1Value)
-                        try :    
+                        try :
                             # keep maximum value seen for printer's internal page counter
                             self.printerInternalPageCounter = max(self.printerInternalPageCounter, self.values[0])
@@ -344,10 +344,10 @@
                                     deviceStatusValues.get(self.deviceStatus), \
                                     self.printerDetectedErrorState))
-                        except IndexError :    
+                        except IndexError :
                             self.parent.filter.logdebug("SNMP answer is incomplete : %s" % str(self.values))
                             pass
-                        else :    
+                        else :
                             return 1
-                    
+
 def main(hostname) :
     """Tries SNMP accounting for a printer host."""
@@ -358,15 +358,15 @@
             self.PrinterName = "FakePrintQueue"
             self.JobSizeBytes = 1
-            
+
         def printInfo(self, msg, level="info") :
             """Prints informational message."""
             sys.stderr.write("%s : %s\n" % (level.upper(), msg))
             sys.stderr.flush()
-            
-        def logdebug(self, msg) :    
+
+        def logdebug(self, msg) :
             """Prints debug message."""
             self.printInfo(msg, "debug")
-            
-    class fakeAccounter :        
+
+    class fakeAccounter :
         """Fakes an accounter for testing purposes."""
         def __init__(self) :
@@ -375,19 +375,19 @@
             self.filter = fakeFilter()
             self.protocolHandler = Handler(self, hostname)
-            
-        def getLastPageCounter(self) :    
+
+        def getLastPageCounter(self) :
             """Fakes the return of a page counter."""
             return 0
-        
-    acc = fakeAccounter()            
+
+    acc = fakeAccounter()
     return acc.protocolHandler.retrieveInternalPageCounter()
-        
-if __name__ == "__main__" :            
-    if len(sys.argv) != 2 :    
+
+if __name__ == "__main__" :
+    if len(sys.argv) != 2 :
         sys.stderr.write("Usage :  python  %s  printer_ip_address\n" % sys.argv[0])
-    else :    
+    else :
         def _(msg) :
             return msg
-            
+
         pagecounter = main(sys.argv[1])
         print "Internal page counter's value is : %s" % pagecounter
Index: pykota/trunk/pykota/accounters/__init__.py
===================================================================
--- pykota/trunk/pykota/accounters/__init__.py (revision 3411)
+++ pykota/trunk/pykota/accounters/__init__.py (revision 3413)
@@ -8,10 +8,10 @@
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
Index: pykota/trunk/pykota/accounters/ink.py
===================================================================
--- pykota/trunk/pykota/accounters/ink.py (revision 3411)
+++ pykota/trunk/pykota/accounters/ink.py (revision 3413)
@@ -8,10 +8,10 @@
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
@@ -36,5 +36,5 @@
                         "GC" : { "G" : "grayscale", "C" : "colored" } ,
                      }
-    def computeJobSize(self) :    
+    def computeJobSize(self) :
         """Do ink accounting for a print job."""
         if (not self.isPreAccounter) and \
@@ -46,5 +46,5 @@
             self.inkUsage = self.filter.preaccounter.inkUsage   # Optimize : already computed !
             return self.filter.softwareJobSize                  # Optimize : already computed !
-            
+
         parameters = [p.strip() for p in self.arguments.split(',')]
         if len(parameters) == 1 :
@@ -54,25 +54,25 @@
         if colorspace not in ("cmyk", "bw", "cmy", "rgb", "gc") :
             raise PyKotaAccounterError, _("Invalid parameters for ink accounter : [%s]") % self.arguments
-            
-        try :    
+
+        try :
             resolution = int(resolution)
-        except ValueError :    
+        except ValueError :
             raise PyKotaAccounterError, "Invalid parameters for ink accounter : [%s]" % self.arguments
-            
+
         self.filter.logdebug("Using internal parser to compute job's size and ink usage.")
-        
+
         jobsize = 0
         if self.filter.JobSizeBytes :
             try :
                 from pkpgpdls import analyzer, pdlparser
-            except ImportError :    
+            except ImportError :
                 self.filter.printInfo("pkpgcounter is now distributed separately, please grab it from http://www.pykota.com/software/pkpgcounter", "error")
                 self.filter.printInfo("Precomputed job size will be forced to 0 pages.", "error")
-            else :     
+            else :
                 options = analyzer.AnalyzerOptions(colorspace=colorspace, resolution=resolution)
                 try :
                     parser = analyzer.PDLAnalyzer(self.filter.DataFile, options)
                     (cspace, pages) = parser.getInkCoverage()
-                except pdlparser.PDLParserError, msg :    
+                except pdlparser.PDLParserError, msg :
                     # Here we just log the failure, but
                     # we finally ignore it and return 0 since this
@@ -80,5 +80,5 @@
                     # job's size MAY be.
                     self.filter.printInfo(_("Unable to precompute the job's size and ink coverage with the generic PDL analyzer : %s") % msg, "warn")
-                else :    
+                else :
                     cspacelabels = self.cspaceExpanded[cspace]
                     for page in pages :
@@ -86,14 +86,14 @@
                         for color in page.keys() :
                             colordict[cspacelabels[color]] = page[color]
-                        self.inkUsage.append(colordict)    
+                        self.inkUsage.append(colordict)
                     jobsize = len(pages)
                     try :
                         if self.filter.Ticket.FileName is not None :
-                            # when a filename is passed as an argument, the backend 
+                            # when a filename is passed as an argument, the backend
                             # must generate the correct number of copies.
                             jobsize *= self.filter.Ticket.Copies
                             self.inkUsage *= self.filter.Ticket.Copies
-                    except AttributeError : # When not run from the cupspykota backend 
+                    except AttributeError : # When not run from the cupspykota backend
                         pass
                     self.filter.logdebug("Ink usage : %s ===> %s" % (cspace, repr(self.inkUsage)))
-        return jobsize        
+        return jobsize
Index: pykota/trunk/pykota/accounters/pjl.py
===================================================================
--- pykota/trunk/pykota/accounters/pjl.py (revision 3411)
+++ pykota/trunk/pykota/accounters/pjl.py (revision 3413)
@@ -8,10 +8,10 @@
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
@@ -21,6 +21,6 @@
 #
 
-"""This module defines the necessary classes and methods to retrieve 
-a printer's internal page counter over a TCP connection.""" 
+"""This module defines the necessary classes and methods to retrieve
+a printer's internal page counter over a TCP connection."""
 
 import sys
@@ -36,7 +36,7 @@
 
 # Old method : PJLMESSAGE = "\033%-12345X@PJL USTATUSOFF\r\n@PJL INFO STATUS\r\n@PJL INFO PAGECOUNT\r\n\033%-12345X"
-# Here's a new method, which seems to work fine on my HP2300N, while the 
+# Here's a new method, which seems to work fine on my HP2300N, while the
 # previous one didn't.
-# TODO : We could also experiment with USTATUS JOB=ON and we would know for sure 
+# TODO : We could also experiment with USTATUS JOB=ON and we would know for sure
 # when the job is finished, without having to poll the printer repeatedly.
 PJLMESSAGE = "\033%-12345X@PJL USTATUS DEVICE=ON\r\n@PJL INFO STATUS\r\n@PJL INFO PAGECOUNT\r\n@PJL USTATUS DEVICE=OFF\033%-12345X"
@@ -52,5 +52,5 @@
                     "40000" : "Sleep Mode",             # Standby
                   }
-                  
+
 class Handler :
     """A class for PJL print accounting."""
@@ -69,10 +69,10 @@
         self.readthread = None
         self.quitEvent = threading.Event()
-        
-    def __del__(self) :    
+
+    def __del__(self) :
         """Ensures the network connection is closed at object deletion time."""
         self.close()
-        
-    def open(self) :    
+
+    def open(self) :
         """Opens the network connection."""
         sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@@ -93,6 +93,6 @@
             self.parent.filter.logdebug("Connected to printer %s:%s" % (self.printerHostname, self.port))
             return True
-        
-    def close(self) :    
+
+    def close(self) :
         """Closes the network connection."""
         if not self.closed :
@@ -107,6 +107,6 @@
             self.queue = None
             self.closed = True
-            
-    def readloop(self) :        
+
+    def readloop(self) :
         """Reading loop thread."""
         self.parent.filter.logdebug("Reading thread started.")
@@ -115,9 +115,9 @@
             try :
                 answer = self.sock.recv(1)
-            except socket.timeout :    
+            except socket.timeout :
                 pass
             except socket.error, (dummy, msg) :
                 self.parent.filter.printInfo(_("Problem while receiving PJL answer from %s:%s : %s") % (self.printerHostname, self.port, str(msg)), "warn")
-            else :    
+            else :
                 if answer :
                     readbuffer.append(answer)
@@ -125,9 +125,9 @@
                         self.queue.put("".join(readbuffer))
                         readbuffer = []
-        if readbuffer :             
-            self.queue.put("".join(readbuffer))            
+        if readbuffer :
+            self.queue.put("".join(readbuffer))
         self.parent.filter.logdebug("Reading thread ended.")
-            
-    def retrievePJLValues(self) :    
+
+    def retrievePJLValues(self) :
         """Retrieves a printer's internal page counter and status via PJL."""
         while not self.open() :
@@ -141,5 +141,5 @@
             except socket.error, msg :
                 self.parent.filter.printInfo(_("Problem while sending PJL query to %s:%s : %s") % (self.printerHostname, self.port, str(msg)), "warn")
-            else :    
+            else :
                 self.parent.filter.logdebug("Query sent to %s : %s" % (self.printerHostname, repr(PJLMESSAGE)))
                 actualpagecount = self.printerStatus = None
@@ -147,26 +147,26 @@
                     try :
                         answer = self.queue.get(True, 5)
-                    except Queue.Empty :    
+                    except Queue.Empty :
                         self.parent.filter.logdebug("Timeout when reading printer's answer from %s:%s" % (self.printerHostname, self.port))
-                    else :    
+                    else :
                         readnext = False
                         self.parent.filter.logdebug("PJL answer : %s" % repr(answer))
-                        for line in [l.strip() for l in answer.split()] : 
+                        for line in [l.strip() for l in answer.split()] :
                             if line.startswith("CODE=") :
                                 self.printerStatus = line.split("=")[1]
                                 self.parent.filter.logdebug("Found status : %s" % self.printerStatus)
-                            elif line.startswith("PAGECOUNT=") :    
+                            elif line.startswith("PAGECOUNT=") :
                                 try :
                                     actualpagecount = int(line.split('=')[1].strip())
-                                except ValueError :    
+                                except ValueError :
                                     self.parent.filter.logdebug("Received incorrect datas : [%s]" % line.strip())
                                 else :
                                     self.parent.filter.logdebug("Found pages counter : %s" % actualpagecount)
-                            elif line.startswith("PAGECOUNT") :    
+                            elif line.startswith("PAGECOUNT") :
                                 readnext = True # page counter is on next line
-                            elif readnext :    
+                            elif readnext :
                                 try :
                                     actualpagecount = int(line.strip())
-                                except ValueError :    
+                                except ValueError :
                                     self.parent.filter.logdebug("Received incorrect datas : [%s]" % line.strip())
                                 else :
@@ -174,7 +174,7 @@
                                     readnext = False
                 self.printerInternalPageCounter = max(actualpagecount, self.printerInternalPageCounter)
-        finally :        
+        finally :
             self.close()
-        
+
     def waitPrinting(self) :
         """Waits for printer status being 'printing'."""
@@ -183,5 +183,5 @@
         if not noprintingmaxdelay :
             self.parent.filter.logdebug("Will wait indefinitely until printer %s is in 'printing' state." % self.parent.filter.PrinterName)
-        else :    
+        else :
             self.parent.filter.logdebug("Will wait until printer %s is in 'printing' state or %i seconds have elapsed." % (self.parent.filter.PrinterName, noprintingmaxdelay))
         previousValue = self.parent.getLastPageCounter()
@@ -192,9 +192,9 @@
             if self.printerStatus in ('10023', '10003') :
                 break
-            if self.printerInternalPageCounter is not None :    
+            if self.printerInternalPageCounter is not None :
                 if firstvalue is None :
                     # first time we retrieved a page counter, save it
                     firstvalue = self.printerInternalPageCounter
-                else :     
+                else :
                     # second time (or later)
                     if firstvalue < self.printerInternalPageCounter :
@@ -213,5 +213,5 @@
                                 # the printer rejected it for some reason.
                                 self.parent.filter.printInfo("Printer %s probably won't print this job !!!" % self.parent.filter.PrinterName, "warn")
-                            else :     
+                            else :
                                 # Here the job has already been entirely printed, and
                                 # the printer has already passed from 'idle' to 'printing' to 'idle' again.
@@ -220,5 +220,5 @@
             self.parent.filter.logdebug(_("Waiting for printer %s to be printing...") % self.parent.filter.PrinterName)
             time.sleep(statusstabilizationdelay)
-        
+
     def waitIdle(self) :
         """Waits for printer status being 'idle'."""
@@ -233,14 +233,14 @@
                    and (os.environ.get("PYKOTAPHASE") == "BEFORE") :
                     self.parent.filter.logdebug("No need to wait for the printer to be idle, it is the case already.")
-                    return 
+                    return
                 idle_num += 1
                 if idle_num >= statusstabilizationloops :
                     # printer status is stable, we can exit
                     break
-            else :    
+            else :
                 idle_num = 0
             self.parent.filter.logdebug(_("Waiting for printer %s's idle status to stabilize...") % self.parent.filter.PrinterName)
             time.sleep(statusstabilizationdelay)
-    
+
     def retrieveInternalPageCounter(self) :
         """Returns the page counter from the printer via internal PJL handling."""
@@ -251,11 +251,11 @@
                self.parent.filter.JobSizeBytes :
                 self.waitPrinting()
-            self.waitIdle()    
-        except :    
+            self.waitIdle()
+        except :
             self.parent.filter.printInfo(_("PJL querying stage interrupted. Using latest value seen for internal page counter (%s) on printer %s.") % (self.printerInternalPageCounter, self.parent.filter.PrinterName), "warn")
             raise
-        else :    
+        else :
             return self.printerInternalPageCounter
-            
+
 def main(hostname) :
     """Tries PJL accounting for a printer host."""
@@ -266,15 +266,15 @@
             self.PrinterName = "FakePrintQueue"
             self.JobSizeBytes = 1
-            
+
         def printInfo(self, msg, level="info") :
             """Prints informational message."""
             sys.stderr.write("%s : %s\n" % (level.upper(), msg))
             sys.stderr.flush()
-            
-        def logdebug(self, msg) :    
+
+        def logdebug(self, msg) :
             """Prints debug message."""
             self.printInfo(msg, "debug")
-            
-    class FakeAccounter :        
+
+    class FakeAccounter :
         """Fakes an accounter for testing purposes."""
         def __init__(self, hostname) :
@@ -283,21 +283,21 @@
             self.filter = FakeFilter()
             self.protocolHandler = Handler(self, hostname)
-            
-        def getLastPageCounter(self) :    
+
+        def getLastPageCounter(self) :
             """Fakes the return of a page counter."""
             return 0
-        
+
     acc = FakeAccounter(hostname)
     return acc.protocolHandler.retrieveInternalPageCounter()
-    
-if __name__ == "__main__" :            
-    if len(sys.argv) != 2 :    
+
+if __name__ == "__main__" :
+    if len(sys.argv) != 2 :
         sys.stderr.write("Usage :  python  %s  printer_ip_address\n" % sys.argv[0])
-    else :    
+    else :
         def _(msg) :
             """Fake gettext method."""
             return msg
-            
+
         pagecounter = main(sys.argv[1])
         print "Internal page counter's value is : %s" % pagecounter
-        
+
