Fix python2 client compatibility

Python2 ignores the byte string qualification (b’foo’)  but falls over for the combination rb for this regexp. Switching the qualification to br appears to fix this and works in both python2 and python3.
This commit is contained in:
Joseph Barker
2020-08-29 21:32:18 +09:00
parent f23510a4fc
commit ec5fb68350

View File

@ -299,8 +299,8 @@ class FirewallClient:
raise Fatal('%r expected STARTED, got %r' % (self.argv, line)) raise Fatal('%r expected STARTED, got %r' % (self.argv, line))
def sethostip(self, hostname, ip): def sethostip(self, hostname, ip):
assert(not re.search(rb'[^-\w\.]', hostname)) assert(not re.search(br'[^-\w\.]', hostname))
assert(not re.search(rb'[^0-9.]', ip)) assert(not re.search(br'[^0-9.]', ip))
self.pfile.write(b'HOST %s,%s\n' % (hostname, ip)) self.pfile.write(b'HOST %s,%s\n' % (hostname, ip))
self.pfile.flush() self.pfile.flush()