def _call_handler(self, request): tokens = tokenize.split(request) try: return protocol.commands.call(tokens, context=self.context) except exceptions.MpdAckError as exc: if exc.command is None: exc.command = tokens[0] raise
def _call_handler(self, request): tokens = tokenize.split(request) # TODO: check that blacklist items are valid commands? blacklist = self.config['mpd'].get('command_blacklist', []) if tokens and tokens[0] in blacklist: logger.warning('Client sent us blacklisted command: %s', tokens[0]) raise exceptions.MpdDisabled(command=tokens[0]) try: return protocol.commands.call(tokens, context=self.context) except exceptions.MpdAckError as exc: if exc.command is None: exc.command = tokens[0] raise
def assertTokenizeRaises(self, exception, message, line): # noqa: N802 with self.assertRaises(exception) as cm: tokenize.split(line) self.assertEqual(cm.exception.message, message)
def assertTokenizeEquals(self, expected, line): # noqa: N802 self.assertEqual(expected, tokenize.split(line))