def cart_add_listener(cart=None, product=None, form=None, request=None, **kwargs):
    """Post-processes the form, handling upsell formfields.

    fields (potentially) in the form:
        upsell_count: controls how many upsell formblocks to look for.
        for ix in range(0,upsell_count):
            upsell_include_ix: true if this one is to be included
            upsell_qty_ix: quantity
            upsell_slug_ix: product slug
    """
    log.debug("cart_add_listener heard satchmo_cart_add_complete")
    try:
        rawct = form.get('upsell_count', 0)
        ct = int(rawct)
    except __HOLE__:
        log.debug("Got bad upsell_count: %s", rawct)
        ct = 0

    results = []
    if ct>0:
        for i in range(0,ct):
            results.append(_add_upsell(form, cart, i))

    return results
dataset/ETHPy150Open dokterbob/satchmo/satchmo/apps/satchmo_ext/upsell/views.py/cart_add_listener