def handle_add_var(request, basket, product_id, quantity=1, **kwargs):
 vars = dict(((int(k.split(u'_')[(-1)]), int(v)) for (k, v) in six.iteritems(kwargs) if k.startswith(u'var_')))
 var_product = ProductVariationResult.resolve(product_id, combination=vars)
 if (not var_product):
  raise ValidationError(_(u'This variation is not available.'), code=u'invalid_variation_combination')
 return handle_add(request=request, basket=basket, product_id=var_product.pk, quantity=quantity)

def handle_add_var ( request , basket , product_id , quantity = 1 , ** kwargs ) : vars = dict ( ( ( int ( k . split ( u'_' ) [ ( - 1 ) ] ) , int ( v ) ) for ( k , v ) in six . iteritems ( kwargs ) if k . startswith ( u'var_' ) ) ) var_product = ProductVariationResult . resolve ( product_id , combination = vars ) if ( not var_product ) : raise ValidationError ( _ ( u'This variation is not available.' ) , code = u'invalid_variation_combination' ) return handle_add ( request = request , basket = basket , product_id = var_product . pk , quantity = quantity )
handle adding a complex variable product into the basket by resolving the combination variables .