return self.get_attributes().get(key=key)
def _add_to_cache(self, key):
+ from philo.models.base import Attribute
try:
attr = self._raw_get_attribute(key)
except Attribute.DoesNotExist:
class PassthroughAttributeMapper(AttributeMapper):
- """Given an iterable of :class:`Entities <philo.models.base.Entity>`, this mapper will fetch an :class:`AttributeMapper` for each one. Lookups will return the value from the first :class:`AttributeMapper` which has an entry for a given key."""
+ """
+ Given an iterable of :class:`Entities <philo.models.base.Entity>`, this mapper will fetch an :class:`AttributeMapper` for each one. Lookups will return the value from the first :class:`AttributeMapper` which has an entry for a given key. Assignments will be made to the first :class:`.Entity` in the iterable.
+
+ :param entities: An iterable of :class:`.Entity` subclass instances.
+
+ """
def __init__(self, entities):
self._attributes = [e.attributes for e in entities]
super(PassthroughAttributeMapper, self).__init__(self._attributes[0].entity)