Example #1
0
    def set(self, state, value, initiator):
        if initiator is self:
            return

        collection_history = self._modified_event(state)
        if _state_has_identity(state):
            old_collection = list(self.get(state))
        else:
            old_collection = []
        collection_history.replace(old_collection, value)
Example #2
0
    def _set_iterable(self, state, dict_, iterable, adapter=None):

        collection_history = self._modified_event(state, dict_)
        new_values = list(iterable)

        if _state_has_identity(state):
            old_collection = list(self.get(state, dict_))
        else:
            old_collection = []

        collections.bulk_replace(new_values, DynCollectionAdapter(self, state, old_collection), DynCollectionAdapter(self, state, new_values))
Example #3
0
    def _set_iterable(self, state, dict_, iterable, adapter=None):

        collection_history = self._modified_event(state, dict_)
        new_values = list(iterable)

        if _state_has_identity(state):
            old_collection = list(self.get(state, dict_))
        else:
            old_collection = []

        collections.bulk_replace(new_values, DynCollectionAdapter(self, state, old_collection), DynCollectionAdapter(self, state, new_values))
Example #4
0
    def class_level_loader(self, state, options=None, path=None):
        if not mapperutil._state_has_identity(state):
            return None

        localparent = mapper._state_mapper(state)

        # adjust for the PropertyLoader associated with the instance
        # not being our own PropertyLoader.
        # TODO: this may no longer be relevant without entity_name
        prop = localparent.get_property(self.key)
        if prop is not self.parent_property:
            return prop._get_strategy(LazyLoader).setup_loader(state)

        return LoadLazyAttribute(state, self.key, options, path)
Example #5
0
    def class_level_loader(self, state, props=None):
        if not mapperutil._state_has_identity(state):
            return None

        localparent = mapper._state_mapper(state)

        # adjust for the ColumnProperty associated with the instance
        # not being our own ColumnProperty.
        # TODO: this may no longer be relevant without entity_name.
        prop = localparent.get_property(self.key)
        if prop is not self.parent_property:
            return prop._get_strategy(DeferredColumnLoader).setup_loader(state)

        return LoadDeferredColumns(state, self.key, props)
Example #6
0
    def class_level_loader(self, state, options=None, path=None):
        if not mapperutil._state_has_identity(state):
            return None

        localparent = mapper._state_mapper(state)

        # adjust for the PropertyLoader associated with the instance
        # not being our own PropertyLoader.
        # TODO: this may no longer be relevant without entity_name
        prop = localparent.get_property(self.key)
        if prop is not self.parent_property:
            return prop._get_strategy(LazyLoader).setup_loader(state)

        return LoadLazyAttribute(state, self.key, options, path)
Example #7
0
    def class_level_loader(self, state, props=None):
        if not mapperutil._state_has_identity(state):
            return None

        localparent = mapper._state_mapper(state)

        # adjust for the ColumnProperty associated with the instance
        # not being our own ColumnProperty.
        # TODO: this may no longer be relevant without entity_name.
        prop = localparent.get_property(self.key)
        if prop is not self.parent_property:
            return prop._get_strategy(DeferredColumnLoader).setup_loader(state)

        return LoadDeferredColumns(state, self.key, props)
Example #8
0
    def _class_level_loader(self, state):
        if not mapperutil._state_has_identity(state):
            return None

        return LoadLazyAttribute(state, self.key)
Example #9
0
 def _class_level_loader(self, state):
     if not mapperutil._state_has_identity(state):
         return None
         
     return LoadDeferredColumns(state, self.key)
Example #10
0
    def _class_level_loader(self, state):
        if not mapperutil._state_has_identity(state):
            return None

        return LoadLazyAttribute(state, self.key)
Example #11
0
    def _class_level_loader(self, state):
        if not mapperutil._state_has_identity(state):
            return None

        return LoadDeferredColumns(state, self.key)