On 6/26/07, Jose Galvez <[EMAIL PROTECTED]> wrote: > > Dear Mike, > Very cool demo. Ive got a couple questions. Looking at the demo, I > don't see any new sessions being created, are they created > automatically?
Yes, that's handled inside SessionContext. We don't pass a session-creation function because we're using the default one. pylons.database needs a session-creation function because it binds the session to an engine, but SAContext is trying to get away from that model (though it comes back in BoundSessionStrategy). > Also my most recent projects use the assignmapper > extension which needs the session context to be passed to it. I > created my maps like this: > > assign_mapper(sac._session_context, Flintstone, flintstones, > extension=sac.ext) > > this works, but I was wondering if that was correct, and if so could you > add a reference to it directly in SAContext so we could use > sac.session_context instead? > > Thanks again for the hard work > Jose Assignmapper is going to be deprecated so I'd recommend not using it in new code. There were a couple large threads on the sqlalchemy list about it right before SAContext was developed. Assignmapper hinders the growth of new Query methods because each one would theoretically have to be shadowed in the mapped classes, and the code that grafts those methods in is an ugly monkeypatch. Plus, every new shadowed method runs the risk of colliding with one of your data attributes someday. SQLAlchemy 0.4 adds some Query methods that are not shadowed; the ones in assignmapper are essentially frozen as they are. The biggest assymetry was having.select() but not .filter(), although maybe that one got added at the last moment. Assignmapper's biggest customer was Exilir but I hear they've since moved away from it. Michael said assignmapper may eventually disappear or parts of it may morph into something else. In spite of all that, sac._session_context should work fine. If there's enough demand I can make a .session_context property, although I can't say it's sufficiently justified at this point. -- Mike Orr <[EMAIL PROTECTED]> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
