Show
Ignore:
Timestamp:
10/04/06 00:21:34 (18 years ago)
Author:
jerome
Message:

Added the 'noprintingmaxdelay' directive to workaround printers
which don't conform to RFC3805.
Improved the reliability of SNMP and PJL hardware accounting.
PJL still needs some work though...

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/accounters/pjl.py

    r2830 r3025  
    131131    def waitPrinting(self) : 
    132132        """Waits for printer status being 'printing'.""" 
     133        try : 
     134            noprintingmaxdelay = int(self.parent.filter.config.getNoPrintingMaxDelay(self.parent.filter.PrinterName)) 
     135        except (TypeError, AttributeError) : # NB : AttributeError in testing mode because I'm lazy ! 
     136            noprintingmaxdelay = NOPRINTINGMAXDELAY 
     137            self.parent.filter.logdebug("No max delay defined for printer %s, using %i seconds." % (self.parent.filter.PrinterName, noprintingmaxdelay)) 
     138        if not noprintingmaxdelay : 
     139            self.parent.filter.logdebug("Will wait indefinitely until printer %s is in 'printing' state." % self.parent.filter.PrinterName) 
     140        else :     
     141            self.parent.filter.logdebug("Will wait until printer %s is in 'printing' state or %i seconds have elapsed." % (self.parent.filter.PrinterName, noprintingmaxdelay)) 
    133142        previousValue = self.parent.getLastPageCounter() 
    134143        timebefore = time.time() 
     
    151160                        self.parent.filter.printInfo("Printer %s is lying to us !!!" % self.parent.filter.PrinterName, "warn") 
    152161                        break 
    153                     elif (time.time() - timebefore) > NOPRINTINGMAXDELAY : 
     162                    elif noprintingmaxdelay and ((time.time() - timebefore) > noprintingmaxdelay) : 
    154163                        # More than X seconds without the printer being in 'printing' mode 
    155164                        # We can safely assume this won't change if printer is now 'idle'