Changeset 3518 for pykota/branches

Show
Ignore:
Timestamp:
04/14/10 23:38:49 (15 years ago)
Author:
jerome
Message:

Backported some code from latest development tree to fix #59.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/branches/1.26_fixes/pykota/accounters/snmp.py

    r3507 r3518  
    292292            else : 
    293293                self.printerInternalPageCounter = max(self.printerInternalPageCounter, int(varBinds[0][1].prettyPrint() or "0")) 
    294                 self.printerStatus = int(varBinds[1][1].prettyPrint()) 
    295                 self.deviceStatus = int(varBinds[2][1].prettyPrint()) 
     294                try : 
     295                    self.printerStatus = int(varBinds[1][1].prettyPrint()) 
     296                except ValueError : 
     297                    self parent.filter.logdebug("The printer reported a non-integer printer status, it will be converted to 2 ('unknown')") 
     298                    self.printerStatus = 2 
     299                try : 
     300                    self.deviceStatus = int(varBinds[2][1].prettyPrint()) 
     301                except ValueError : 
     302                    self.parent.filter.logdebug("The printer reported a non-integer device status, it will be converted to 1 ('unknown')") 
     303                    self.deviceStatus = 1 
    296304                self.printerDetectedErrorState = self.extractErrorStates(str(varBinds[3][1])) 
    297305                self.parent.filter.logdebug("SNMP answer decoded : PageCounter : %s  PrinterStatus : '%s'  DeviceStatus : '%s'  PrinterErrorState : '%s'" \