192 | | rsp.berDecode(wholeMsg) |
193 | | if req.apiAlphaMatch(rsp): |
194 | | errorStatus = rsp.apiAlphaGetPdu().apiAlphaGetErrorStatus() |
195 | | if errorStatus: |
196 | | self.parent.filter.printInfo(_("Problem encountered while doing SNMP queries on printer %s : %s") % (self.printerHostname, errorStatus), "warn") |
197 | | else: |
198 | | self.values = [] |
199 | | for varBind in rsp.apiAlphaGetPdu().apiAlphaGetVarBindList(): |
200 | | self.values.append(varBind.apiAlphaGetOidVal()[1].rawAsn1Value) |
201 | | try : |
202 | | # keep maximum value seen for printer's internal page counter |
203 | | self.printerInternalPageCounter = max(self.printerInternalPageCounter, self.values[0]) |
204 | | self.printerStatus = self.values[1] |
205 | | except IndexError : |
206 | | pass |
207 | | else : |
208 | | return 1 |
| 196 | try : |
| 197 | rsp.berDecode(wholeMsg) |
| 198 | except TypeMismatchError, msg : |
| 199 | self.parent.filter.printInfo(_("SNMP message decoding error for printer %s : %s") % (self.printerHostname, msg), "warn") |
| 200 | else : |
| 201 | if req.apiAlphaMatch(rsp): |
| 202 | errorStatus = rsp.apiAlphaGetPdu().apiAlphaGetErrorStatus() |
| 203 | if errorStatus: |
| 204 | self.parent.filter.printInfo(_("Problem encountered while doing SNMP queries on printer %s : %s") % (self.printerHostname, errorStatus), "warn") |
| 205 | else: |
| 206 | self.values = [] |
| 207 | for varBind in rsp.apiAlphaGetPdu().apiAlphaGetVarBindList(): |
| 208 | self.values.append(varBind.apiAlphaGetOidVal()[1].rawAsn1Value) |
| 209 | try : |
| 210 | # keep maximum value seen for printer's internal page counter |
| 211 | self.printerInternalPageCounter = max(self.printerInternalPageCounter, self.values[0]) |
| 212 | self.printerStatus = self.values[1] |
| 213 | except IndexError : |
| 214 | pass |
| 215 | else : |
| 216 | return 1 |