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)
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))
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)
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)
def _class_level_loader(self, state): if not mapperutil._state_has_identity(state): return None return LoadLazyAttribute(state, self.key)
def _class_level_loader(self, state): if not mapperutil._state_has_identity(state): return None return LoadDeferredColumns(state, self.key)