def _get_account():
    try:
        ua = UserAccount.load()
    except Exception as e:
        app.logger.info("Creating new CLF session.")
        app.logger.info("(reason: %s)" % e)
        ua = UserAccount()
    ua.set_cache_dir(os.path.join(cache_dir, 'reqs'))
    return ua
def before_request():
    try:
        g.account = UserAccount.load()
    except:
        ua = UserAccount()
        ua.save()
        g.account = ua

    if request.args.get('nocache', False):
        g.account.set_caches(DummyCache())
    else:
        g.account.set_caches(cache)