On Jul 4, 2008, at 5:40 AM, Iwan wrote:
> > OK, I've had a look at that code. Just to make sure I get it, would > the following theoretically work? > > Assume I have a class, CC, which is smart enough to maintain a > _singleton_ instance of a normal dict somewhere on the callstack. If > you do CC.get_context(), it will always return that single dict. > Assume also that CC.get_context_hash() returns id(CC.get_context()) > > Then, what you're saying is that I can do: > > Session = scoped_session(sessionmaker(), > scopefunc=CC.get_context_hash) > > And that's it? Does this make sense? if get_context_hash returns a dict, thats specifically what would *not* work since its not hashable. The scopefunc's return value is placed in a dict keyed against the appropriate Session, so its anything that is actually hashable. Any kind of hashable token that identifies the scope you want (in this case a frame) will do. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---