sounds good to me -- S i x F e e t U p , I n c . | http://www.sixfeetup.com Phone: +1 (317) 861-5948 x605 ANNOUNCING the first Plone Immersive Training Experience | Sept. 10-11-12, 2009 http://www.sixfeetup.com/immerse
On Thu, Feb 19, 2009 at 11:25 AM, Rob LaRubbio <[email protected]> wrote: > 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 -~----------~----~----~----~------~----~------~--~---
