| 343 | |
| 344 | def getParentPrintersFromBackend(self, printer) : |
| 345 | """Get all the printer groups this printer is a member of.""" |
| 346 | pgroups = [] |
| 347 | result = self.doSearch("SELECT groupid,printername FROM printergroupsmembers JOIN printers ON groupid=id WHERE printerid=%s;" % self.doQuote(printer.ident)) |
| 348 | if result : |
| 349 | for record in result : |
| 350 | if record["groupid"] != printer.ident : # in case of integrity violation |
| 351 | parentprinter = self.getPrinter(record.get("printername")) |
| 352 | if parentprinter.Exists : |
| 353 | pgroups.append(parentprinter) |
| 354 | return pgroups |
400 | | def getParentPrinters(self, printer) : |
401 | | """Get all the printer groups this printer is a member of.""" |
402 | | pgroups = [] |
403 | | result = self.doSearch("SELECT groupid,printername FROM printergroupsmembers JOIN printers ON groupid=id WHERE printerid=%s;" % self.doQuote(printer.ident)) |
404 | | if result : |
405 | | for record in result : |
406 | | if record["groupid"] != printer.ident : # in case of integrity violation |
407 | | parentprinter = self.getPrinter(record.get("printername")) |
408 | | if parentprinter.Exists : |
409 | | pgroups.append(parentprinter) |
410 | | return pgroups |
411 | | |