114 | | for line in lines : |
115 | | (begin, end) = line.split(':', 1) |
116 | | deviceuri = end.strip() |
117 | | queuename = begin.split()[-1] |
118 | | if self.matchString(queuename, namestomatch) : |
119 | | printers.append((queuename, deviceuri)) |
120 | | else : |
121 | | self.printInfo("Print queue %s skipped." % queuename) |
| 113 | server = pkipplib.CUPS() |
| 114 | for queuename in server.getPrinters() : |
| 115 | req = server.newRequest(pkipplib.IPP_GET_PRINTER_ATTRIBUTES) |
| 116 | req.operation["printer-uri"] = ("uri", server.identifierToURI("printers", queuename)) |
| 117 | req.operation["requested-attributes"] = ("keyword", "device-uri") |
| 118 | result = server.doRequest(req) |
| 119 | try : |
| 120 | deviceuri = result.printer["device-uri"][0][1] |
| 121 | except (AttributeError, IndexError, KeyError) : |
| 122 | deviceuri = None |
| 123 | if deviceuri is not None : |
| 124 | if self.matchString(queuename, namestomatch) : |
| 125 | printers.append((queuename, deviceuri)) |
| 126 | else : |
| 127 | self.printInfo("Print queue %s skipped." % queuename) |