From: Christian Heller Date: Sat, 5 Dec 2020 14:30:17 +0000 (+0100) Subject: While rtrim() doesn't work to allow \n-trailed tablet logins, this does. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/decks/bar%20baz.html?a=commitdiff_plain;h=c1024023126d1fd91be3145e50cae4b493d7a956;p=plomrogue2 While rtrim() doesn't work to allow \n-trailed tablet logins, this does. --- diff --git a/plomrogue/parser.py b/plomrogue/parser.py index 2820c18..22e9059 100644 --- a/plomrogue/parser.py +++ b/plomrogue/parser.py @@ -77,9 +77,12 @@ class Parser: """Parse msg as call to function, return function with args tuple. Respects function signature defined in function's .argtypes attribute. + + Throws out messages with any but a small list of acceptable characters. + """ import string - msg = msg.rstrip() + msg = msg.replace('\n', ' ') # Inserted by some tablet keyboards. legal_chars = string.digits + string.ascii_letters +\ string.punctuation + ' ' + 'ÄäÖöÜüߧ' + 'éèáàô' for c in msg: