On Sat, 2007-15-12 at 19:39 -0500, Mark Ramm wrote: > > > Here's what I figure I have to get in there to port my work so far: > > > > > > - SA 0.4 with assign_mapper equivalent syntax ( Foo.query.get_by() ) > > > > You'll need to use the DBSession.mapper (which is a contextual mapper) > > for this (just in case you haven't figured that out already) > > To be a bit more specific, I believe the mapper we use is actually > contextual by default, but you should just use DBSession directly, and > not instantiate it becaus DBSession acts transparently as a proxy to a > thread-local session.
Ok, I think I am doing this wrong then, but really I don't know how the model is even supposed to look. We could do with a good rough doc on that I guess. The quickstart does not make any model files beyond __init__.py, and webstart.py is setup by default to make tables from that file only. So how should the model work as per attaching the right mapper? And what is the user supposed to have to do to get quickstart setup-add to work right? What I did ( wrong I'm sure ) is put in the __init__.py model: from page import * And in page.py: DBSession = scoped_session(sessionmaker(autoflush=True, transactional=True)) mapper = DBSession.mapper But then that instantiation is in both model files. Looks wrong to me, but I couldn't figure out how to get the mapper I wanted available to the submodel file. Can I import DBSession from __init__? ( seemed like a circular dependancy, but I'm still amazed at what python can make sense of sometimes. This is a spot where the rough 20min wiki doc is completely different from what we get out of quickstart. If someone has an example of how it should be done, I'll copy that and we can edit the 20min wiki doc. iain --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears Trunk" 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/turbogears-trunk?hl=en -~----------~----~----~----~------~----~------~--~---
