Randomness (RE: [Zope-dev] CoreSessionTracking 0.8)

Matt Hamilton matth@netsight.co.uk
Fri, 25 May 2001 17:36:32 +0100 (BST)


On Fri, 25 May 2001, Bjorn Stabell wrote:

> session = context.session_mgr.getSessionData()
> 
> cart = session.get('shopping_cart', {})
> 
> sku = int(sku)
> 
> if not cart.has_key(sku):
>   cart[sku] = 0
> 
> if int(qty)>0: 
>    cart[sku] = cart[sku] + int(qty)


Could this be the same problem that I was experiencing, in that
dicts/btrees do not in themselves notify the persitence machinery that
they have changed? try adding cart._p_changed = 1 to the code after
modifying cart{}.

-Matt


-- 
Matt Hamilton                                         matth@netsight.co.uk
Netsight Internet Solutions, Ltd.          Business Vision on the Internet
http://www.netsight.co.uk                               +44 (0)117 9090901
Web Hosting | Web Design  | Domain Names  |  Co-location  | DB Integration