def get_diff_options(req):
    options_data = {}
    data = {'options': options_data}

    def get_bool_option(name, default=0):
        pref = req.session.as_int('diff_' + name, default)
        arg = int(name in req.args)
        if 'update' in req.args and arg != pref:
            req.session.set('diff_' + name, arg, default)
        else:
            arg = pref
        return arg

    pref = req.session.get('diff_style', 'inline')
    style = req.args.get('style', pref)
    if 'update' in req.args and style != pref:
        req.session.set('diff_style', style, 'inline')
    data['style'] = style

    pref = req.session.as_int('diff_contextlines', 2)
    context = req.args.as_int('contextlines', pref)
    if 'update' in req.args and context != pref:
        req.session.set('diff_contextlines', context, 2)
    options_data['contextlines'] = context

    arg = req.args.as_int('contextall', 0)
    options_data['contextall'] = arg
    options = ['-U%d' % (-1 if arg else context)]

    arg = get_bool_option('ignoreblanklines')
    if arg:
        options.append('-B')
    options_data['ignoreblanklines'] = arg

    arg = get_bool_option('ignorecase')
    if arg:
        options.append('-i')
    options_data['ignorecase'] = arg

    arg = get_bool_option('ignorewhitespace')
    if arg:
        options.append('-b')
    options_data['ignorewhitespace'] = arg

    return (style, options, data)
Multi-db fixtures are loaded correctly
dataset/ETHPy150Open edgewall/trac/trac/versioncontrol/diff.py/get_diff_options--crossover with--dataset/ETHPy150Open django/django/tests/multiple_database/tests.py/FixtureTestCase.test_fixture_loading