I'm writing a new formgen adapter that annotates the cart, and then when the
order is charged saves it to salesforce.  I'm running into an issue where
the cart is getting recreated (and thus my annotation lost).  Looking at the
code the behaviour seems different between these two calls:

Products/PloneGetPaid/cart.py

    def _getCartForUser(self, context, uid, create=False):
        cart = self._sessions.get(uid)
        if cart or not create:
            return cart
        cart = ShoppingCart()
        cart.member_id = uid
        self._sessions[uid] = cart
        return cart


    def _getCartForSession(self, context, create=False, browser_id=None):
        session_manager = getToolByName(context, 'session_data_manager')
        if browser_id is None:
            if not session_manager.hasSessionData() and not create:
                return
            session = session_manager.getSessionData()
        else:
            session = session_manager.getSessionDataByKey(browser_id)
            if session is None:
                return
        if not session.has_key('getpaid.cart'):
            if create:
                session['getpaid.cart'] = cart = ShoppingCart()
            else:
                return None
        return session['getpaid.cart']

In _getCartForUser if you call it with create=True it will always create a
new cart, while in _getCartForSession it only creates a new cart if one
doesn't exist.  I'm assuming it is a bug in the first method, and that this
line:

        if cart or not create:
            return cart

should actually be this:

        if cart is not None or not create:
            return cart

Can someone verify this?  Thanks.

-Rob

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"getpaid-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/getpaid-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to