Every object you retrieved before committing the session must be
linked again to a session as the session gets removed when committing.
So you must call DBSession.merge(object, load=False) on all the
objects you had before committing the transaction.

Usually you can avoid that by using DBSession.flush instead of
transaction.commit as other said.

On Wed, Sep 19, 2012 at 1:12 PM, Juan Antonio Ibáñez
<[email protected]> wrote:
> Commiting the transaction manually disables the possibility to get data
> after that getting one error as:
>
> Instance <User at 0xa9d782c> is not bound to a Session; attribute refresh
> operation cannot proceed
>
> Regards
>
> El martes, 18 de septiembre de 2012 20:17:26 UTC+2, Carlos Daniel Ruvalcaba
> Valenzuela escribió:
>>
>> TurboGears uses a transaction manager whose default behaviour is to
>> commit if the function (view) is successful or to rollback if the
>> function fails (if it throws an exception or returns an http error
>> code), you can also tap the manager and commit/abort transactions
>> explicitely by importing the module transaction:
>>
>> impor transaction
>>
>> class MyController(BaseController):
>>     def index(self):
>>         # Your code here
>>         transaction.commit()
>>
>> For more info (albeit a bit incomplete) check the docs:
>>
>> http://www.turbogears.org/2.2/docs/main/Config/SQLAlchemy.html
>>
>> Regards,
>> Carlos Daniel Ruvalcaba Valenzuela
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/turbogears/-/ge5rQaZ8bqQJ.
>
> 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.

-- 
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