(cls, username, password, email=None, analyst=None)
Create (and save) a new user with the given username, password and
        email address.
Create (and save) a new user with the given username, password and
        email address.
Create ( and save ) a new user with the given username password and email address .
def create_user(cls, username, password, email=None, analyst=None):
        """
        Create (and save) a new user with the given username, password and
        email address.
        """

        now = datetime.datetime.now()

        # Normalize the address by lowercasing the domain part of the email
        # address.
        if email is not None:
            try:
                email_name, domain_part = email.strip().split('@', 1)
            except ValueError:
                pass
            else:
                email = '@'.join([email_name, domain_part.lower()])

        user = cls(username=username, email=email, date_joined=now)
        user.create_api_key("default", analyst, default=True)
        if password and user.set_password(password):
            user.save(username=analyst)
            return user
        elif CRITsConfig.remote_user:
            user.save(username="CRITS_REMOTE_USER")
            return user
        else:
            return None
def create_user ( cls , username , password , email = None , analyst = None ) : now = datetime . datetime . now ( ) # Normalize the address by lowercasing the domain part of the email # address. if email is not None : try : email_name , domain_part = email . strip ( ) . split ( '@' , 1 ) except ValueError : pass else : email = '@' . join ( [ email_name , domain_part . lower ( ) ] ) user = cls ( username = username , email = email , date_joined = now ) user . create_api_key ( "default" , analyst , default = True ) if password and user . set_password ( password ) : user . save ( username = analyst ) return user elif CRITsConfig . remote_user : user . save ( username = "CRITS_REMOTE_USER" ) return user else : return None