mpd: Make request handler **kwargs keys bytestrings (#302)
This commit is contained in:
parent
928034222a
commit
61dcb7d37d
@ -56,7 +56,12 @@ def handle_request(pattern, auth_required=True):
|
||||
if match is not None:
|
||||
mpd_commands.add(
|
||||
MpdCommand(name=match.group(), auth_required=auth_required))
|
||||
compiled_pattern = re.compile(pattern, flags=re.UNICODE)
|
||||
# NOTE: Make pattern a bytestring to get bytestring keys in the dict
|
||||
# returned from matches.groupdict(), which is again used as a **kwargs
|
||||
# dict. This is needed to work on Python < 2.6.5. See
|
||||
# https://github.com/mopidy/mopidy/issues/302 for details.
|
||||
bytestring_pattern = pattern.encode('utf-8')
|
||||
compiled_pattern = re.compile(bytestring_pattern, flags=re.UNICODE)
|
||||
if compiled_pattern in request_handlers:
|
||||
raise ValueError('Tried to redefine handler for %s with %s' % (
|
||||
pattern, func))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user