Index: /pykota/trunk/conf/pykota.conf.sample
===================================================================
--- /pykota/trunk/conf/pykota.conf.sample (revision 3158)
+++ /pykota/trunk/conf/pykota.conf.sample (revision 3162)
@@ -671,5 +671,35 @@
 accounter: software()
 
-
+# Should we ensure that the printer really is idle before 
+# sending the job's datas to it ?
+#
+# This directive is only used when you use an internal 
+#�hardware accounting mechanism, like hardware(snmp) or
+# hardware(pjl), and is not used for external hardware
+# accounting mechanisms or for software or ink accounting.
+#
+# If PyKota and CUPS are properly configured, i.e. a single
+# computer (the print server) can access to a particular physical 
+# printer, or all CUPS+PyKota print servers which access to the
+# same physical printer share a common network directory used
+# by PyKota to lock this printer resource, then it is not necessary
+# to really ensure the printer is idle before the job, because
+# this is already the case : we already wait at the end of the
+# preceding job for the printer to be idle before reading its
+# internal page counter. So setting this value to Yes usually
+# saves a lot of time between jobs, generally around 30 seconds.
+#
+# If you're not sure, leave this value to the default which is No,
+# meaning that before sending the job's datas to the printer, PyKota
+# will ensure this printer is in idle state.
+#
+# If not defined, a value of No is assumed.
+# 
+# This value can be set either globally or on a per printer basis
+# If both are defined, the printer option has priority.
+#
+# Sane default :
+#
+skipinitialwait : no
 
 # What is the "pre"-accounter used for precomputing the job's size.
Index: /pykota/trunk/TODO
===================================================================
--- /pykota/trunk/TODO (revision 3157)
+++ /pykota/trunk/TODO (revision 3162)
@@ -28,14 +28,4 @@
           minimal price. The value wouldn't be used (yet?) for 
           normal page accounting.
-          
-        - Allow for configurable setting wrt the fact that PyKota waits
-          for the printer being idle before asking for printer's internal 
-          page counter before sending any data to the printer : if
-          the print server is correctly configured (i.e. only PyKota can
-          access to this particular printer), then we know for sure the
-          printer will be idle at this time, because we wait for it
-          to become idle again after having printed the job => we could
-          save up to 50% of waiting time, and handle more jobs
-          in the same time.
           
         - --orderby and --order ASC|DESC for dumpykota (or --asc | --desc)
Index: /pykota/trunk/pykota/accounters/hardware.py
===================================================================
--- /pykota/trunk/pykota/accounters/hardware.py (revision 3133)
+++ /pykota/trunk/pykota/accounters/hardware.py (revision 3162)
@@ -109,10 +109,11 @@
            The external command must report the life time page number of the printer on stdout.
         """
+        skipinitialwait = self.filter.config.getPrinterSkipInitialWait(printer)
         commandline = self.arguments.strip() % locals()
         cmdlower = commandline.lower()
         if (cmdlower == "snmp") or cmdlower.startswith("snmp:") :
-            return snmp.Handler(self, printer).retrieveInternalPageCounter()
+            return snmp.Handler(self, printer, skipinitialwait).retrieveInternalPageCounter()
         elif (cmdlower == "pjl") or cmdlower.startswith("pjl:") :
-            return pjl.Handler(self, printer).retrieveInternalPageCounter()
+            return pjl.Handler(self, printer, skipinitialwait).retrieveInternalPageCounter()
             
         if printer is None :
Index: /pykota/trunk/pykota/accounters/snmp.py
===================================================================
--- /pykota/trunk/pykota/accounters/snmp.py (revision 3161)
+++ /pykota/trunk/pykota/accounters/snmp.py (revision 3162)
@@ -109,7 +109,8 @@
 class BaseHandler :
     """A class for SNMP print accounting."""
-    def __init__(self, parent, printerhostname) :
+    def __init__(self, parent, printerhostname, skipinitialwait=False) :
         self.parent = parent
         self.printerHostname = printerhostname
+        self.skipinitialwait = skipinitialwait
         try :
             self.community = self.parent.arguments.split(":")[1].strip()
@@ -210,4 +211,9 @@
         while 1 :
             self.retrieveSNMPValues()
+            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, this should be the case already.")
+                return 
             pstatusAsString = printerStatusValues.get(self.printerStatus)
             dstatusAsString = deviceStatusValues.get(self.deviceStatus)
Index: /pykota/trunk/pykota/accounters/pjl.py
===================================================================
--- /pykota/trunk/pykota/accounters/pjl.py (revision 3133)
+++ /pykota/trunk/pykota/accounters/pjl.py (revision 3162)
@@ -58,7 +58,8 @@
 class Handler :
     """A class for PJL print accounting."""
-    def __init__(self, parent, printerhostname) :
+    def __init__(self, parent, printerhostname, skipinitialwait=False) :
         self.parent = parent
         self.printerHostname = printerhostname
+        self.skipinitialwait = skipinitialwait
         try :
             self.port = int(self.parent.arguments.split(":")[1].strip())
@@ -181,4 +182,9 @@
         while 1 :
             self.retrievePJLValues()
+            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, this should be the case already.")
+                return 
             idle_flag = 0
             if self.printerStatus in ('10000', '10001', '35078', '40000') :
Index: /pykota/trunk/pykota/config.py
===================================================================
--- /pykota/trunk/pykota/config.py (revision 3158)
+++ /pykota/trunk/pykota/config.py (revision 3162)
@@ -691,4 +691,10 @@
             else :
                 del branches[k] # empty value disables a global option
-                
         return branches
+        
+    def getPrinterSkipInitialWait(self, printername) :
+        """Returns True if we want to skip the initial waiting loop, else False."""
+        try :
+            return self.isTrue(self.getPrinterOption(printername, "skipinitialwait"))
+        except PyKotaConfigError :
+            return False
Index: /pykota/trunk/pykota/version.py
===================================================================
--- /pykota/trunk/pykota/version.py (revision 3153)
+++ /pykota/trunk/pykota/version.py (revision 3162)
@@ -22,5 +22,5 @@
 #
 
-__version__ = "1.26alpha4_unofficial"
+__version__ = "1.26alpha5_unofficial"
 
 __doc__ = "PyKota : a complete Printing Quota Solution for CUPS."
