"""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.replace('\n', ' ') # Inserted by some tablet keyboards.
+ legal_chars = string.digits + string.ascii_letters +\
+ string.punctuation + ' ' + 'ÄäÖöÜüߧ' + 'éèáàô'
+ for c in msg:
+ if not c in legal_chars:
+ raise ArgError('Command/message contains illegal character(s), '
+ 'may only contain ones of: %s' % legal_chars)
tokens = self.tokenize(msg)
if len(tokens) == 0:
return None, ()