def create_user(cls, email, password, admin=False): try: with DATABASE.transaction(): cls.create(email=email, password=make_hash(password), admin=admin) except IntegrityError: raise ValueError("User already exists.")
def create_user(cls, username, email, password, admin=False): try: cls.create( username=username, email=email, password=make_hash(password), is_admin=admin) except peewee.IntegrityError: raise ValueError('User already exists')
def create_user(cls, email, password, admin=False): try: with DATABASE.transaction(): cls.create( email=email, password=make_hash(password), admin=admin) except IntegrityError: raise ValueError("User already exists.")