Skip to content

Commit 52e1849

Browse files
authored
Merge pull request #268 from MatthijsBurgh/patch-1
Migrate from deprecated splittype to urlparse
2 parents 0020c3c + 9c0a9ae commit 52e1849

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

system-config-printer.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -973,23 +973,23 @@ def populateList(self, prompt_allowed=True):
973973
elif object.is_class:
974974
type = 'local-class'
975975
else:
976-
(scheme, rest) = urllib.parse.splittype (object.device_uri)
977-
if scheme in ['ipp', 'ipps']:
978-
if rest.startswith("//localhost"): # IPP-over-USB
976+
parsed = urllib.parse.urlparse (object.device_uri)
977+
if parsed.scheme in ['ipp', 'ipps']:
978+
if parsed.netloc.startswith("localhost"): # IPP-over-USB
979979
type = 'local-printer'
980980
else: # IPP network printer
981981
type = 'ipp-printer'
982-
elif scheme == 'smb':
982+
elif parsed.scheme == 'smb':
983983
type = 'smb-printer'
984-
elif scheme == 'hpfax':
984+
elif parsed.scheme == 'hpfax':
985985
type = 'local-fax'
986-
elif scheme in ['socket', 'lpd', 'dnssd']:
986+
elif parsed.scheme in ['socket', 'lpd', 'dnssd']:
987987
type = 'network-printer'
988988
elif object.device_uri.startswith('hp:/net/'):
989989
type = 'network-printer'
990990
elif object.device_uri.startswith('hpfax:/net/'):
991991
type = 'network-printer'
992-
elif scheme == 'implicitclass': # cups-browsed-discovered
992+
elif parsed.scheme == 'implicitclass': # cups-browsed-discovered
993993
type = 'discovered-printer'
994994

995995
(tip, icon) = PRINTER_TYPE[type]

0 commit comments

Comments
 (0)