What version of tg are you using or it might be sqlalchemy specific
thing?
Quickstart creation using tg-admin quickstart -s -i projname will
produce a project containing a model.py where you can see a line
containing

from turbogears.database import metadata, session

So I am not sure how there will be an import error :)


On Oct 2, 2:35 pm, vrs762 <[EMAIL PROTECTED]> wrote:
> Hmmm... when I try to import session from turbogears.database, it says
> importerror: cannot import name session.
>
> On Oct 1, 5:19 pm, Dakila <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I am using SQLAlchemy instead of SQLObject, but I believe you just
> > have to import the session.
>
> > from turbogears.database import session
>
> > On Oct 2, 12:15 am, vrs762 <[EMAIL PROTECTED]> wrote:
>
> > > Thanks for this info.
>
> > > Looking at some documentation, I added
>
> > > session_filter.on = True into the global section of dev.cfg and
> > > prod.cfg
>
> > > However, TG does not recognize session.begin().
>
> > > Seems like the session object has to be instantiated in the
> > > controller. What would be the syntax for doing that?
>
> > > On Oct 1, 12:18 am, "Ivo Looser" <[EMAIL PROTECTED]> wrote:
>
> > > > Hi,
>
> > > > You should try session.save(e).
>
> > > > If you whould like to commit explicit you should use:
>
> > > > from model import Person
>
> > > > session.begin()
> > > > e = Person.selectBy(name=inputname)
> > > > e.address = newaddress
> > > > session.save(e)
> > > > session.commit()
>
> > > > Ivo
>
> > > > On 10/1/07, vrs762 <[EMAIL PROTECTED]> wrote:
>
> > > > > Hi,
>
> > > > > In my controller, I am accessing a specific record from the Person
> > > > > table, and trying to update the address attribute:
> > > > > ..........
> > > > >  from model import Person
> > > > >  e = Person.selectBy(name=inputname)
> > > > >  e.address = newaddress
>
> > > > > However, this change is not getting committed to the actual table. How
> > > > > do I explicitly do that from the controller?
>
> > > > > Thanks,


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to