def handle_update(request, basket, **kwargs):
 methods = cached_load(u'SHUUP_BASKET_UPDATE_METHODS_SPEC')(request=request, basket=basket)
 prefix_method_dict = methods.get_prefix_to_method_map()
 basket_changed = False
 for (key, value) in six.iteritems(kwargs):
  for (prefix, method) in six.iteritems(prefix_method_dict):
   if key.startswith(prefix):
    line_id = key[len(prefix):]
    line = basket.find_line_by_line_id(line_id)
    field_changed = method(key=key, value=value, line=line)
    basket_changed = (basket_changed or field_changed)
    break
 if basket_changed:
  basket.clean_empty_lines()
  basket.dirty = True

def handle_update ( request , basket , ** kwargs ) : methods = cached_load ( u'SHUUP_BASKET_UPDATE_METHODS_SPEC' ) ( request = request , basket = basket ) prefix_method_dict = methods . get_prefix_to_method_map ( ) basket_changed = False for ( key , value ) in six . iteritems ( kwargs ) : for ( prefix , method ) in six . iteritems ( prefix_method_dict ) : if key . startswith ( prefix ) : line_id = key [ len ( prefix ) : ] line = basket . find_line_by_line_id ( line_id ) field_changed = method ( key = key , value = value , line = line ) basket_changed = ( basket_changed or field_changed ) break if basket_changed : basket . clean_empty_lines ( ) basket . dirty = True
handle updating a basket .