diff --git a/mopidy/models/__init__.py b/mopidy/models/__init__.py index 7cf8cc77..e4e8528a 100644 --- a/mopidy/models/__init__.py +++ b/mopidy/models/__init__.py @@ -30,6 +30,11 @@ class Ref(ImmutableObject): #: The object name. Read-only. name = fields.String() + #: The object type, e.g. "artist", "album", "track", "playlist", + #: "directory". Read-only. + type = fields.Identifier() # TODO: consider locking this down. + # type = fields.Field(choices=(ALBUM, ARTIST, DIRECTORY, PLAYLIST, TRACK)) + #: Constant used for comparison with the :attr:`type` field. ALBUM = 'album' @@ -45,10 +50,6 @@ class Ref(ImmutableObject): #: Constant used for comparison with the :attr:`type` field. TRACK = 'track' - #: The object type, e.g. "artist", "album", "track", "playlist", - #: "directory". Read-only. - type = fields.Field(choices=(ALBUM, ARTIST, DIRECTORY, PLAYLIST, TRACK)) - @classmethod def album(cls, **kwargs): """Create a :class:`Ref` with ``type`` :attr:`ALBUM`.""" diff --git a/tests/models/test_models.py b/tests/models/test_models.py index c9c91ba1..bdfd1896 100644 --- a/tests/models/test_models.py +++ b/tests/models/test_models.py @@ -113,7 +113,7 @@ class RefTest(unittest.TestCase): def test_repr_without_results(self): self.assertEqual( - "Ref(name=u'foo', type=u'artist', uri='uri')", + "Ref(name=u'foo', type='artist', uri='uri')", repr(Ref(uri='uri', name='foo', type='artist'))) def test_serialize_without_results(self):