This view shows a cart and processes a cart submission. You can try it on our staging server at:
http://tixsa.giantbyte.com You'll have to find an event with tickets and add it to your cart. The code in question is: http://dpaste.com/hold/63158/ Everything works fine on FF. On IE, everything is fine if the user clicks on the Checkout button which posts to this same view. But the ticket quantity box is user-editable and if the user clicks in it and hits the Return key, it generates this error (with a useless traceback): ValueError at /cart/view/ The view cart.views.view didn't return an HttpResponse object. But every branch in the function seems to call HttpResponseRedirect. Here's the view (or use dpaste above). Does anyone know what's going on? def view_cart(request): cart = Cart(request) items = cart.get_items() # get last shopping page so we can return there if user wants to last_shop_url = request.session.get('last_shop_url') if request.method == 'POST': for key in request.POST: parts = key.split('_') if parts[0] == 'quant': item_id = parts[1] try: quantity = int(request.POST[key]) except: # key is non-integer request.notifications.create('Invalid quantity in cart', 'error') return HttpResponseRedirect('/cart/view/') if quantity == 0: request.notifications.create('Ticket quantity is zero. Please click Remove to remove an item from cart, or select a quantity greater than zero', 'error') return HttpResponseRedirect('/cart/view/') if quantity < 0: request.notifications.create('Ticket quantity is less than zero - please try a positive number', 'error') return HttpResponseRedirect('/cart/view/') the_item = Item.objects.get(id=item_id) ticket_id = the_item.object_id ticket = Ticket.objects.get(id=ticket_id) new_quantity = check_inventory(request, ticket, quantity, after_cart=True) if new_quantity == SOLD_OUT: return HttpResponseRedirect('/') if new_quantity != quantity: # if quantity changed, go back to cart, don't continue to checkout return HttpResponseRedirect('/cart/view/') # user has clicked Checkout with valid values for all tickets for item in items: if item.object_id == ticket_id: if item.quantity != new_quantity: ticket = item.product old = ticket.pending ticket.pending = ticket.pending - (item.quantity - new_quantity) ticket.save() if new_quantity != 0: cart.update_quantity(ticket, new_quantity) else: cart.remove(ticket) if 'update' in request.POST: return HttpResponseRedirect('/cart/view/') elif 'checkout' in request.POST: if request.user.has_perm('event.add_order'): return HttpResponseRedirect('/ecommerce/ staffcheckouttype/') else: return HttpResponseRedirect('/ecommerce/ pickup_or_ship/') else: return HttpResponseRedirect('/ecommerce/pickup_or_ship/') return HttpResponseRedirect('/') # never reached, but maybe python doesn't know that? else: # GET # need to store item quantities here to detect if they are adjusted merch_total = 0 for item in items: merch_total += item.unit_price * item.quantity return render_to_response('cart/view.html', { 'cart': cart, 'items': items, 'last_shop_url': last_shop_url, 'merch_total': merch_total, }, context_instance=RequestContext(request)) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" 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/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

