- changed milestone to 0.6.xx
passive argument ignored in get_history() for scalar attributes
Issue #1303
duplicate
i.e.:
def get_history(self, state, passive=PASSIVE_OFF):
return History.from_attribute(
self, state, state.dict.get(self.key, NO_VALUE))
should be more like:
def get_history(self, state, passive=PASSIVE_OFF):
if self.key in state.dict:
return History.from_attribute(self, state, state.dict[self.key](self.key))
else:
current = self.get(state, passive=passive)
if current is PASSIVE_NORESULT:
return HISTORY_BLANK
else:
return History.from_attribute(self, state, current)
this to support extensions which need to get attribute history regardless of an object being expired or having deferred columns. workaround is to force a load using getattr(). but the passive flag shouldn't be silently ignored.
however, SA's ORM doesn't need this itself, and the fact that it's ignored right now might be fulfilling part of the current behavioral contract, i.e. don't load the old value unnecessarily. So ensure that get_history() is always called with PASSIVE_OFF for scalars right now and that honoring the flag doesn't result in unnecessary loads.
Comments (3)
-
reporter -
reporter - changed milestone to blue sky
let's bring this out of blue sky when an actual use case comes up for it.
-
reporter - changed status to duplicate
Duplicate of
#2787. - Log in to comment