

def create_token(self, request, user, **kwargs):
    'Create the token\n        '
    odm = request.app.odm()
    ip_address = request.get_client_address()
    user_id = (user.id if user.is_authenticated() else None)
    with odm.begin() as session:
        token = odm.token(id=uuid.uuid4(), user_id=user_id, ip_address=ip_address, user_agent=self.user_agent(request, 80), **kwargs)
        session.add(token)
    return token.add_encoded(request, token)

dataset/ETHPy150Open quantmind/lux/lux/extensions/auth/backends.py AuthMixin.create_token/VarMisuse@110/143 `self`->`token`