> So see what happens if you, for the moment, just monkeypatch over 
> orm.session._state_session to do a lookup in a global context if 
> state.session_id isn't set.  If that solves the problem of "I want detached 
> objects to load stuff", for you and everyone else who wants this feature, 
> then whatever - I'm not at all thrilled about this use case but if it's just 
> one trivial hook that I don't need to encourage, then there you go.
>

Please give me a lesson in monkeypatching 101.  This isn't being
invoked:

=====================
import sqlalchemy.orm.session as session_module
sqla_state_session = session_module._state_session
def _state_session(state):
    """
    for transient/detached objects, so we can automatically query
these related objects
    """
    return sqla_state_session(state) or DBSession()
setattr(session_module, '_state_session', _state_session)
=====================

I presume there are already references to _state_session before I
change it.


Also, will this cause other side effects, such as obj in DBSession
reporting True when it used to report False or the orm internals being
confused by the return of this value?

Thanks again!

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to