On Mar 22, 2010, at 5:10 AM, King Simon-NFHD78 wrote:
> 
> See the 'How can I get the Session for a certain object' question at
> http://www.sqlalchemy.org/docs/session.html#frequently-asked-questions
> 
> Basically, in your FindFriends method, replace:
> 
>   session = Session()
> 
> with:
> 
>   session = Session.object_session(self)

The reference documentation seems to indicate that Session.object_session() 
will return the existing session if one exists, rather than providing a new 
session that must be separately closed.

Is this correct? If so, then FindFriends() should not close the session 
acquired via Session.object_session(obj), correct?

Is it possible for object_session() to return None if the object's session was 
previously close()d?

Thanks,

Daniel

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

Reply via email to