Also, I tried doing the p.save() and flushed right after that but nothing. It did not commit it to the db. only p.flush() works. Is there something I'm doing wrong with my session creations here? Note that my:
session = create_session() Is being done in some other module which I import in this module. session is now accessible and I can use it as session.flush() etc. but it takes no effect. Do I need to pass any variables to create_session() to associate the session with an engine? Thanks, sam. On Jul 4, 5:58 pm, SamDonaldson <[EMAIL PROTECTED]> wrote: > In turbogears, we never were required to do an explicit save on the > object. We could just do the session.flush() and that was it and I > think that was because of the mapper session.context being > associated. Does anybody know how to get the same functionality here > to make the code even cleaner? > > Thanks, > > Sam. > > On Jul 4, 5:55 pm, Jose Galvez <[EMAIL PROTECTED]> wrote: > > > You should be doing p.save() and then session.flush() > > Jose > > > SamDonaldson wrote: > > > Folks, I'm moving from Turbogears to Pylons and I need help > > > understanding the following. Right now, when I create a session by > > > doing the following: > > > > session = create_session() > > > > And then create some objects below as : Page(...), I find that after > > > doing a session.flush(), nothing happens. I don't see any commits to > > > the db unless I do something like p = Page() and then p.flush(). > > > Basically, my session is not associated with anything. In turbogears, > > > the session was given to us and we passed it into the mapper as > > > assign_mapper(session.context, ....), but here, we're importing > > > something else called session_context and passing that in. How can I > > > associate my session with the mapper so that a session.flush() takes > > > effect. > > > > In pylons: > > > class Page(object): > > > def __str__(self): > > > return self.title > > > > page_mapper = assign_mapper(ctx, Page, pages_table) > > > > In tg: > > > page_mapper = assign_mapper(session.context, Page, pages_table) > > > > Thanks in advance, > > > > Sam --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
