Changeset 3503 for pykota

Show
Ignore:
Timestamp:
09/03/09 08:29:19 (15 years ago)
Author:
jerome
Message:

Better handle printers which return an empty string when we ask their
printerStatus and deviceStatus. Now by default consider the status as
being "unknown" in this case, instead of failing.

Files:
1 modified

Legend:

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

    r3489 r3503  
    284284            else : 
    285285                self.printerInternalPageCounter = max(self.printerInternalPageCounter, int(varBinds[0][1].prettyPrint() or "0")) 
    286                 self.printerStatus = int(varBinds[1][1].prettyPrint()) 
    287                 self.deviceStatus = int(varBinds[2][1].prettyPrint()) 
     286                self.printerStatus = int(varBinds[1][1].prettyPrint() or "2") # or unknown 
     287                self.deviceStatus = int(varBinds[2][1].prettyPrint() or "1")  # or unknown 
    288288                self.printerDetectedErrorState = self.extractErrorStates(str(varBinds[3][1])) 
    289289                self.parent.filter.logdebug("SNMP answer decoded : PageCounter : %s  PrinterStatus : '%s'  DeviceStatus : '%s'  PrinterErrorState : '%s'" \