I agree that it's better to let users set the "dirty" flag if they
want.

It would also be great if you can change the Session.load() method to
NOT save the session immediately after loading it (not at the end of
the request), as is the case today. This auto-saving upon first access
is quite useless because subsequent changes to the session during the
same request need to be saved separately afterwards. The Session.load
() method can set the "dirty" flag if the "autosave" options is
"if_accessed".

Together these changes can help avoiding the multiple save() that is
happening today every time the session is used.

On Jan 7, 10:16 am, Ben Bangert <[email protected]> wrote:
> On Jan 7, 2009, at 4:59 AM, Paweł Stradomski wrote:
>
> > Just note, that in case the dict is not modified directly, but an  
> > object
> > inside is modified, you won't get notified of the change.
>
> > Eg. suppose the restored session has:
> > session['messages'] = []
>
> > Now i do:
> > session['messages'].append(u'New flash message')
>
> > You won't see that the session has changed.
>
> This is the exact reason we don't have a 'dirty' type flag like this  
> set on setitem. However, I think it'd be useful to let a user set the  
> 'dirty' flag themselves, in addition to letting sessions auto-save  
> merely upon access (just to be sure), or something as Tycon suggests.  
> Many people end up calling save() multiple times because they need to  
> put stuff in the session in various places and ensures its saved, when  
> really, they should be marking it 'to-be-saved' so its done just *once*.
>
> Tycon, I'll have some time later today to merge a patch to that effect  
> in.
>
> Cheers,
> Ben
>
>  smime.p7s
> 3KViewDownload
--~--~---------~--~----~------------~-------~--~----~
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