Fix 8-bit Telnet with Py3K
authorJeremy Stanley <fungi@yuggoth.org>
Tue, 28 Jun 2016 06:50:50 +0000 (06:50 +0000)
committerJeremy Stanley <fungi@yuggoth.org>
Tue, 28 Jun 2016 06:50:50 +0000 (06:50 +0000)
Replace the lambda filter for non-ASCII characters with a list
comprehension, correcting and simplifying the range comparison and
recombination of the filtered string.

lib/mudpy/misc.py

index c0845c5..b3f2e25 100644 (file)
@@ -908,8 +908,7 @@ class User:
                 # log non-printable characters remaining
                 if mudpy.telnet.is_enabled(self, mudpy.telnet.TELOPT_BINARY,
                                            mudpy.telnet.HIM):
                 # log non-printable characters remaining
                 if mudpy.telnet.is_enabled(self, mudpy.telnet.TELOPT_BINARY,
                                            mudpy.telnet.HIM):
-                    asciiline = b"".join(
-                        filter(lambda x: b" " <= x <= b"~", line))
+                    asciiline = bytes([x for x in line if 32 <= x <= 126])
                     if line != asciiline:
                         logline = "Non-ASCII characters from "
                         if self.account and self.account.get("name"):
                     if line != asciiline:
                         logline = "Non-ASCII characters from "
                         if self.account and self.account.get("name"):