Exemplo n.º 1
0
 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
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
 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
Exemplo n.º 4
0
 def assertTokenizeRaises(self, exception, message, line):  # noqa: N802
     with self.assertRaises(exception) as cm:
         tokenize.split(line)
     self.assertEqual(cm.exception.message, message)
Exemplo n.º 5
0
 def assertTokenizeEquals(self, expected, line):  # noqa: N802
     self.assertEqual(expected, tokenize.split(line))