Yes, I understand that. This is a development and code organization
>From the developer's point-of-view there is a special namespace called
session variables. What I want to be able to do is have the coders
to get the current value of the session variable and
to save the value. The type of the variable should be transparent to the
programmer--that is, it could be a number, a string, a dictionary, or a
My question restated: Is there a way to write a generic
setSessionVariable()routine that handles the mutated values properly
for arbitrary types.
That is, does something like
def setSessionVariable( name, value ):
request = container.REQUEST
session = request.session
a = session.get(name,0)
a = value
manage persistence correctly if value is a dictionary or a list
and mutated from the old value, whatever it may have been. Or is it
necessary to specifically include an assignment for each mutated
component of the dictionary or list?
What happens when the value to be stored is a dictionary of dictionaries
of lists and has been mutated?
Is there an advantage to using the persistent Dictionary and List classes
in the session rather than ordinary ones?
Thanks again for your insight.
On Thu, 15 Dec 2005, Chris McDonough wrote:
> There is nothing that needs to be done here. It's only if you
> *mutate* values stored in the session that you need to do explicit
> persistence triggering. I provided an example of doing this in my
> last email.
> - C
> On Dec 15, 2005, at 4:20 PM, Dennis Allison wrote:
> > Chris McDonnough pointed out a problem with my setSessionVariable
> > code which I am now fixing. I want a generic routine to set a session
> > variable whether it is a simple variable, a list, or a dictionary.
> > The question is one of triggering the persistence mechanism. If a
> > dictionary or list is stored in a session variable, what is needed to
> > ensure that the setSessionVariable() routine triggers the persistence
> > mechanism?
> > Is it adequate to simply read the session variable in the
> > setSessionVariable() routine prior to writing it when the session
> > variable
> > is a dictionary or list? Or is something else needed?
Zope maillist - Zope@zope.org
** No cross posts or HTML encoding! **
(Related lists -