Problem with accessing attributes after transaction.commit()

已查看 10 次
跳至第一个未读帖子

salmon

未读,
2009年9月2日 08:47:382009/9/2
收件人 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

未读,
2009年9月2日 11:39:122009/9/2
收件人 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

未读,
2009年9月3日 04:42:362009/9/3
收件人 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
回复全部
回复作者
转发
0 个新帖子