def fix_db(filename):
    params = dict(session.app['params'])
    content = read_file(filename, 'rb')
    if session.app['tables'] in 'auth_user':
        auth_user = make_table('auth_user', session.app['table_auth_user'])
        content = content.replace('sqlite://storage.sqlite',
                                  params['database_uri'])
        content = content.replace('auth.define_tables()',
                                  auth_user + 'auth.define_tables(migrate = settings.migrate)')
    content += """
mail.settings.server = settings.email_server
mail.settings.sender = settings.email_sender
mail.settings.login = settings.email_login
"""
    if params['login_method'] == 'janrain':
        content += """
from gluon.contrib.login_methods.rpx_account import RPXAccount
auth.settings.actions_disabled=['register','change_password',
    'request_reset_password']
auth.settings.login_form = RPXAccount(request,
    api_key = settings.login_config.split(':')[-1],
    domain = settings.login_config.split(':')[0],
    url = "http://%s/%s/default/user/login" % (request.env.http_host,request.application))
"""
    write_file(filename, content, 'wb')
dataset/ETHPy150Open uwdata/termite-data-server/web2py/applications-original/admin/controllers/wizard.py/fix_db/swapped operands of `in`