On Apr 11, 2006, at 6:50 PM, Kevin Dangoor wrote:

> On 4/11/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> I ought to pass object identifiers around for page to page rather  
>> than
>> object themselves, then re-get the object from the database within  
>> the
>> next page's code. Is this a correct observation, a necessary pattern?
>
> I actually think that this is more an observation about use of
> sessions than the implicit transactions. Generally speaking, implicit
> transactions do what you really want to happen anyhow.
>
> There are no guarantees about putting an SQLObject (or other kind of
> persistent object) into a session. Most persistent objects have some
> kind of association with the connection they were created from. From
> request to request, you can't count on that being the same connection.
>
> Hanging on to the object id is a good solution, imho.

I don't know the specifics of how sessions work in TG, but there's no  
technical reason you couldn't put SQLObjects in a session correctly  
if sessions were treated kinda like a pickle store.  The session- 
serialization for a SQLObject would simply be a reference to the  
class and the object's id.  When you pull it out of the session from  
some other request, it would simply resurrect that object using the  
current connection.

Personally I prefer the explicit by-identifier way and try and keep  
the state on the client instead of in a session (for a lot of  
reasons) but there's nothing inherently dangerous about the pattern  
that the user tried first (if the pieces fit together properly).

-bob


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

Reply via email to