Fix crash in local backend when looking up unknown path

This commit is contained in:
Stein Magnus Jodal 2012-09-11 23:23:36 +02:00
parent 32987d7a00
commit dbf7030d5b
3 changed files with 6 additions and 3 deletions

View File

@ -71,6 +71,8 @@ v0.8 (in development)
- Created a Spotify track proxy that will switch to using loaded data as soon
as it becomes available. Fixes :issue:`72`.
- Fixed crash on lookup of unknown path when using local backend.
v0.7.3 (2012-08-11)
===================

View File

@ -203,7 +203,8 @@ class LocalLibraryProvider(BaseLibraryProvider):
try:
return self._uri_mapping[uri]
except KeyError:
raise LookupError('%s not found.' % uri)
logger.debug(u'Failed to lookup "%s"', uri)
return None
def find_exact(self, **query):
self._validate_query(query)

View File

@ -34,8 +34,8 @@ class LibraryControllerTest(object):
self.assertEqual(track, self.tracks[0])
def test_lookup_unknown_track(self):
test = lambda: self.library.lookup('fake uri')
self.assertRaises(LookupError, test)
track = self.library.lookup('fake uri')
self.assertEquals(track, None)
def test_find_exact_no_hits(self):
result = self.library.find_exact(track=['unknown track'])