X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/9ce01076f2854a0f3c95391becc6af08073796cd..ac54db264df3ba87306945a5494bd89e38266c38:/philo/utils/entities.py diff --git a/philo/utils/entities.py b/philo/utils/entities.py index f52620f..05e41fc 100644 --- a/philo/utils/entities.py +++ b/philo/utils/entities.py @@ -117,6 +117,7 @@ class LazyAttributeMapperMixin(object): 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: @@ -164,7 +165,12 @@ class LazyTreeAttributeMapper(LazyAttributeMapperMixin, TreeAttributeMapper): class PassthroughAttributeMapper(AttributeMapper): - """Given an iterable of :class:`Entities `, 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 `, 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)