Set the session **before** calling ``setup_for_bottle`` like this:

        @hook('before_request')
        def setup_request():
            request.session = request.environ['beaker.session']

def setup_for_bottle(
        auth, app, send_email=None, render=None,
        session=None, request=None, urloptions=None):
    import bottle

    auth.request = request or bottle.request
    if session is not None:
        auth.session = session
    if send_email:
        auth.send_email = send_email

    auth.render = render or bottle.template
    bottle.BaseTemplate.defaults['csrf_token'] = auth.get_csrf_token
    bottle.BaseTemplate.defaults['auth'] = auth

    """
    Set the session **before** calling ``setup_for_bottle`` like this:

        @hook('before_request')
        def setup_request():
            request.session = request.environ['beaker.session']
    """

    @bottle.hook('before_request')
    def after_request():
        auth.session = session or getattr(bottle.request, 'session') \
            or bottle.request.environ.get('beaker.session')
        assert auth.session, 'Session not found'

        # By doing this, ``bottle.request`` now has a ``user`` attribute
        # that it's replaced by the real user object the first time is used.
        LazyUser(auth, bottle.request, user_name=auth.user_name)

    if auth.views:
        assert auth.render
        setup_for_bottle_views(auth, app, urloptions)