I'm trying to store temporary cart in session, but cart items
disappear after 3-4 page reloads.
This is simplified version of my code, that reproduces the issue:

"""
class C(object):
    ITEMS = {}

    def pprint(self):
        return str(self.ITEMS)

class I(dict):
    pass

def my_context_processor(request):
    import random

    result = {}

    if request.session.get('TEMP', None) is None:
        request.session['TEMP'] = C()
    cart = request.session['TEMP']

    if not cart.ITEMS:
        i = I()
        i.cart = cart
        i["a"] = random.randint(1,10)
        i["b"] = random.randint(1,10)
        cart.ITEMS['blah'] = i
        request.session['TEMP'] = cart
        request.session.modified = True

    result['test'] = cart

    return result
"""


In template, after third of fourth reload I see {{ test }} updated,
when it shouldn't. Why ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to