Changeset 3517

Show
Ignore:
Timestamp:
04/14/10 23:37:39 (14 years ago)
Author:
jerome
Message:

Reworked the existing code to log informational messages and prepare for
backport.

Files:
1 modified

Legend:

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

    r3506 r3517  
    280280        else : 
    281281            self.printerInternalPageCounter = max(self.printerInternalPageCounter, int(varBinds[0][1].prettyPrint() or "0")) 
    282             self.printerStatus = int(varBinds[1][1].prettyPrint() or "2") # or unknown 
    283             self.deviceStatus = int(varBinds[2][1].prettyPrint() or "1")  # or unknown 
     282            try : 
     283                self.printerStatus = int(varBinds[1][1].prettyPrint()) 
     284            except ValueError : 
     285                self parent.filter.logdebug("The printer reported a non-integer printer status, it will be converted to 2 ('unknown')") 
     286                self.printerStatus = 2 
     287            try : 
     288                self.deviceStatus = int(varBinds[2][1].prettyPrint()) 
     289            except ValueError : 
     290                self.parent.filter.logdebug("The printer reported a non-integer device status, it will be converted to 1 ('unknown')") 
     291                self.deviceStatus = 1 
    284292            self.printerDetectedErrorState = self.extractErrorStates(str(varBinds[3][1])) 
    285293            self.parent.filter.logdebug("SNMP answer decoded : PageCounter : %s  PrinterStatus : '%s'  DeviceStatus : '%s'  PrinterErrorState : '%s'" \