patially revert #132dc4c:

Removing overloaded __dir__ on LibModel. This was making me
unconfortable, as I don't know that it will not break something else.
This commit is contained in:
Pedro Silva 2015-05-17 15:03:26 +02:00
parent 684f4deadc
commit bc6f5869b4

View file

@ -312,10 +312,6 @@ class LibModel(dbcore.Model):
def __unicode__(self):
return format(self)
def __dir__(self):
return (self._fields.keys() + self._getters().keys() +
self._types.keys())
class FormattedItemMapping(dbcore.db.FormattedMapping):
"""Add lookup for album-level fields.
@ -489,7 +485,8 @@ class Item(LibModel):
plugin_fields = []
for plugin in plugins.find_plugins():
plugin_fields += plugin.template_fields.keys()
return super(Item, cls).__dir__(cls()), plugin_fields
return (cls._fields.keys() + cls._getters().keys() +
cls._types.keys()), plugin_fields
def __setitem__(self, key, value):
"""Set the item's value for a standard field or a flexattr.
@ -924,7 +921,8 @@ class Album(LibModel):
plugin_fields = []
for plugin in plugins.find_plugins():
plugin_fields += plugin.album_template_fields.keys()
return super(Album, cls).__dir__(cls()), plugin_fields
return (cls._fields.keys() + cls._getters().keys() +
cls._types.keys()), plugin_fields
def items(self):
"""Returns an iterable over the items associated with this