decouple mpd.protocol module from config structure
removed reference to password from protocol, moved it to Context class.
This commit is contained in:
parent
039fc4b681
commit
3a184f9ddd
@ -229,8 +229,8 @@ class MpdContext(object):
|
||||
#: The current :class:`mopidy.mpd.MpdSession`.
|
||||
session = None
|
||||
|
||||
#: The Mopidy configuration.
|
||||
config = None
|
||||
#: The MPD password
|
||||
password = None
|
||||
|
||||
#: The Mopidy core API. An instance of :class:`mopidy.core.Core`.
|
||||
core = None
|
||||
@ -246,7 +246,8 @@ class MpdContext(object):
|
||||
def __init__(self, dispatcher, session=None, config=None, core=None):
|
||||
self.dispatcher = dispatcher
|
||||
self.session = session
|
||||
self.config = config
|
||||
if config is not None:
|
||||
self.password = config['mpd']['password']
|
||||
self.core = core
|
||||
self.events = set()
|
||||
self.subscriptions = set()
|
||||
|
||||
@ -39,7 +39,7 @@ def password(context, password):
|
||||
This is used for authentication with the server. ``PASSWORD`` is
|
||||
simply the plaintext password.
|
||||
"""
|
||||
if password == context.config['mpd']['password']:
|
||||
if password == context.password:
|
||||
context.dispatcher.authenticated = True
|
||||
else:
|
||||
raise MpdPasswordError('incorrect password')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user