[Zope] Re: [Zope-dev] Re: sessions in the presence of conflicts

Chris McDonough chrism at plope.com
Tue Dec 20 05:39:50 EST 2005


On Dec 20, 2005, at 12:36 AM, Dennis Allison wrote:

>
> The interaction between sessions, conflicts, and persistence is a bit
> confusing.  I am still trying to understand the code in depth.
>
> One thing is for sure, request.SESSION and/or request['SESSION']  
> must be
> persistent for things to work.  Mutable objects in the session  
> variable
> set (dictionaries and lists) have to be handled specially to get the
> persistence machinery to recognize they have been changed.
>
> In this case, I am trying to ensure that the session variables get
> identified as persistent.  My question is whether using update (an
> implicit assignment) triggers the persistence mechanism.  It is the
> moral equivalent of writing
>
> 	request['SESSION']['alpha'] = 'a'B
> 	request['SESSION']['beta'] = 'b'
>
> but I am unsure whether the persistence mechanism will recognize it as
> such.


The implementation of TransientObjects's update method is:

     def update(self, d):
         self._p_changed = 1
         for k in d.keys():
             self[k] = d[k]


So yes...

- C



More information about the Zope-Dev mailing list