On Sep 13, 4:19 am, pydon <[email protected]> wrote:
> Hopefully reading this correctly.
>
> So I cannot store a whole object in a session but instead should just
> store a reference to it?

The session only stores an object reference anyway. I think what's
being suggested is to store a (primary) key in the session for easy DB
lookup.

I think which approach you choose depends on your app. I have an app
where I store a reference to the SA user object in the session and
this works fine for me. The trick is that you have to do `Session.merge
(session['user'])` (or something to that effect) at the beginning of
each request.


> Does this not require querying the database all the time for
> information on this object? (recreate it when required)
>
> For instance every time I want the users name I would use the user id
> in the session to query SA for the user and then check his/her name
>
> - Pydon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to