def create_lti_user(lti_user_id, lti_consumer):
 edx_password = str(uuid.uuid4())
 created = False
 while (not created):
  try:
   edx_user_id = generate_random_edx_username()
   edx_email = '{}@{}'.format(edx_user_id, settings.LTI_USER_EMAIL_DOMAIN)
   with transaction.atomic():
    edx_user = User.objects.create_user(username=edx_user_id, password=edx_password, email=edx_email)
    edx_user_profile = UserProfile(user=edx_user)
    edx_user_profile.save()
   created = True
  except IntegrityError:
   pass
 lti_user = LtiUser(lti_consumer=lti_consumer, lti_user_id=lti_user_id, edx_user=edx_user)
 lti_user.save()
 return lti_user

def create_lti_user ( lti_user_id , lti_consumer ) : edx_password = str ( uuid . uuid4 ( ) ) created = False while ( not created ) : try : edx_user_id = generate_random_edx_username ( ) edx_email = '{}@{}' . format ( edx_user_id , settings . LTI_USER_EMAIL_DOMAIN ) with transaction . atomic ( ) : edx_user = User . objects . create_user ( username = edx_user_id , password = edx_password , email = edx_email ) edx_user_profile = UserProfile ( user = edx_user ) edx_user_profile . save ( ) created = True except IntegrityError : pass lti_user = LtiUser ( lti_consumer = lti_consumer , lti_user_id = lti_user_id , edx_user = edx_user ) lti_user . save ( ) return lti_user
generate a new user on the edx platform with a random username and password .