|
27 | 27 |
|
28 | 28 | def PreferredDrivers (filename): |
29 | 29 | preferreddrivers = xml.etree.ElementTree.XML (open (filename).read ()) |
30 | | - return preferreddrivers.getchildren() |
| 30 | + return list(preferreddrivers) |
31 | 31 |
|
32 | 32 | class DeviceIDMatch: |
33 | 33 | """ |
@@ -227,18 +227,18 @@ def load (self, drivertypes): |
227 | 227 | """ |
228 | 228 |
|
229 | 229 | types = [] |
230 | | - for drivertype in drivertypes.getchildren (): |
| 230 | + for drivertype in list(drivertypes): |
231 | 231 | t = DriverType (drivertype.attrib["name"]) |
232 | 232 |
|
233 | | - for child in drivertype.getchildren (): |
| 233 | + for child in list(drivertype): |
234 | 234 | if child.tag == "ppdname": |
235 | 235 | t.add_ppd_name (child.attrib["match"]) |
236 | 236 | elif child.tag == "attribute": |
237 | 237 | t.add_attribute (child.attrib["name"], |
238 | 238 | child.attrib["match"]) |
239 | 239 | elif child.tag == "deviceid": |
240 | 240 | deviceid_match = DeviceIDMatch () |
241 | | - for field in child.getchildren (): |
| 241 | + for field in list(child): |
242 | 242 | if field.tag == "field": |
243 | 243 | deviceid_match.add_field (field.attrib["name"], |
244 | 244 | field.attrib["match"]) |
@@ -414,29 +414,29 @@ def load (self, preferreddrivers): |
414 | 414 | Load the policy from an XML file. |
415 | 415 | """ |
416 | 416 |
|
417 | | - for printer in preferreddrivers.getchildren (): |
| 417 | + for printer in list(preferreddrivers): |
418 | 418 | ptype = PrinterType () |
419 | | - for child in printer.getchildren (): |
| 419 | + for child in list(printer): |
420 | 420 | if child.tag == "make-and-model": |
421 | 421 | ptype.add_make_and_model (child.attrib["match"]) |
422 | 422 | elif child.tag == "deviceid": |
423 | 423 | deviceid_match = DeviceIDMatch () |
424 | | - for field in child.getchildren (): |
| 424 | + for field in list(child): |
425 | 425 | if field.tag == "field": |
426 | 426 | deviceid_match.add_field (field.attrib["name"], |
427 | 427 | field.attrib["match"]) |
428 | 428 | ptype.add_deviceid_match (deviceid_match) |
429 | 429 |
|
430 | 430 | elif child.tag == "drivers": |
431 | | - for drivertype in child.getchildren (): |
| 431 | + for drivertype in list(child): |
432 | 432 | ptype.add_drivertype_pattern (drivertype.text) |
433 | 433 |
|
434 | 434 | elif child.tag == "avoid": |
435 | | - for drivertype in child.getchildren (): |
| 435 | + for drivertype in list(child): |
436 | 436 | ptype.add_avoidtype_pattern (drivertype.text) |
437 | 437 |
|
438 | 438 | elif child.tag == "blacklist": |
439 | | - for drivertype in child.getchildren (): |
| 439 | + for drivertype in list(child): |
440 | 440 | ptype.add_blacklisted (drivertype.text) |
441 | 441 |
|
442 | 442 | self.ptypes.append (ptype) |
|
0 commit comments