def _update_context(context, postdata):
    '''
    Updates the default selections with user's selections.
    '''
    listCheck = lambda el: el[0] if type(el) == list else el  # For handling lists of size 1
    widget_id = listCheck(postdata.get('widget_id'))
    context.target_table = listCheck(postdata.get('target_table%s' % widget_id))
    context.target_att = listCheck(postdata.get('target_att%s' % widget_id))
    context.tables = postdata.get('tables%s' % widget_id, [])
    if context.target_table not in context.tables:
        raise Exception('The selected target table "%s" is not among the selected tables.' % context.target_table)
    # Propagate the selected tables
    for table in context.cols.keys():
        if table not in context.tables:
            del context.cols[table]
    for pair in context.connected.keys():
        if pair[0] in context.tables and pair[1] in context.tables:
            continue
        del context.connected[pair]
    for table in context.tables:
        context.cols[table] = postdata.get('%s_columns%s' % (table, widget_id), [])
        if table == context.target_table and context.target_att not in context.cols[table]:
            raise Exception(
                'The selected target attribute ("%s") is not among the columns selected for the target table ("%s").' % (
                context.target_att, context.target_table))
    if context.in_memory:
        context.orng_tables = None  # Reset to make sure up-to-date tables are created
        context.orng_tables = context.read_into_orange()
Updates the default selections with user's selections.