[Zope] RE: CST and disappearing variables (still)

Ron Bickers rbickers-dated-1002592167.52dd40@logicetc.com
Mon, 1 Oct 2001 21:49:26 -0400


> -----Original Message-----
> From: Chris McDonough [mailto:chrism@zope.com]

> I have no suggestions at the moment.  A reliable way to reproduce the
> problem would be useful (but probably difficult).

Yeah.  I can't reproduce it myself no matter how many times I try.  Well...
back to square one then, I guess.

Is there anything special I need to be concerned about regarding persistence
when using CST?

For example, in a Python Script, I do the following:

  item = {}
  ... populate item with some stuff ...

  cart = session.get('cart', [])
  cart.append(item)
  session.set('cart', cart)

Is this something that CST should be able to handle properly?

The only other thing I do that might be strange is getting the session data
more than once in a transaction as follows:

When the final Python Script 'sendOrder' is called from the Web, it goes
something like this:

  session = context.SDM.getSessionData()
  message = container.message(container, custinfo=session['custinfo'])
  ... send message ...

The DTML Method 'message' called above has this:

  <dtml-with custinfo mapping>
  ... name, address, etc. variables from 'custinfo' ...
  </dtml-with>

  <dtml-var textview>

The DTML Method 'textview' inserted at the end of the 'message' has this:

  <dtml-let items="Items()">
  <dtml-unless items>
  Your cart is empty.
  </dtml-unless>
  <dtml-if items>
  <dtml-in items mapping>
  ... display items ...
  </dtml-in>
  </dtml-if>

The Python Script 'Items' is as follows:

  session = context.SDM.getSessionData()
  return session.get('cart', [])

So, 'textview' calls the Python Script 'Items' which gets the session data
again.  Is there anything wrong with doing this, or can you see anything
dangerous in my logic?  It seems so clear and simple to me, but I'm
questioning pretty much everything now.

Thanks for your help.
_______________________

Ron Bickers
Logic Etc, Inc.