Problem with accessing attributes after transaction.commit()

8 views
Skip to first unread message

salmon

unread,
Sep 2, 2009, 8:47:38 AM9/2/09
to TurboGears
Hi,
I have problem with sqlalchemy in TG2.
After transaction.commit() I can't access model objects. I'm getting
this error:

geditor.user_id
*** UnboundExecutionError: Instance <User at 0x928c90c> is not bound
to a Session; attribute refresh operation cannot proceed

It's easy to reproduce:

paster quicstart test
in test/websetup.py after line 'transaction.commit()' add print
editor.user_id
paster setup-app development.ini

Any idea what I'm doing wrong?

regards,

salmon

Diez B. Roggisch

unread,
Sep 2, 2009, 11:39:12 AM9/2/09
to turbo...@googlegroups.com

Well, the error-message pretty much says it - you aren't allowed to access
persistent objects outside an active session, which means a transaction needs
to be going on.

Either do whatever you want to do before committing, or open a new transaction
afterwards.

Diez

salmon

unread,
Sep 3, 2009, 4:42:36 AM9/3/09
to TurboGears
Hi,

I found this thread in archive http://www.mail-archive.com/turbo...@googlegroups.com/msg37691.html.
That explains everything to me.

regards,

salmon
Reply all
Reply to author
Forward
0 new messages