

def create_user(self, request, username=None, password=None, email=None, first_name=None, last_name=None, active=False, superuser=False, odm_session=None, **kwargs):
    'Create a new user.\n\n        Either ``username`` or ``email`` must be provided.\n        '
    odm = request.app.odm()
    email = normalise_email(email)
    assert (username or email)
    if username:
        self.validate_username(request, username)
    with odm.begin(session=odm_session) as session:
        if (not username):
            username = email
        if session.query(odm.user).filter_by(username=username).count():
            raise ValueError('Username not available')
        if (email and session.query(odm.user).filter_by(email=email).count()):
            raise ValueError('Email not available')
        user = odm.user(username=username, password=self.password(password), email=email, first_name=first_name, last_name=last_name, active=active, superuser=superuser)
        session.add(user)
    return user

dataset/ETHPy150Open quantmind/lux/lux/extensions/auth/backends.py AuthMixin.create_user/original