def register_user(email, password): db_user = User.find_one({'email': email}) if db_user is not None: raise InvalidDataError( translation.get_current().EXCEPTION_USER_ALREADY_EXISTS) user = User() user.email = email user.password = password saved = User.create(user) return saved
print(os.getcwd()) import app from app.config import * from app.db import * from app.cli.cli_manager import * app.boot() from entities.user import User from entities.location import Location # u = User() # u.name = "asd" # u.password="******" # u.locations = [ # Location(name="test location"), # Location(name="test location"), # Location(name="test location") # ] # u.save() # print(u.id) # print(u.render()) l = Location(name="test") l.user = User(name="asd", password="******") l.save() l = Location(name="test") l.user = User.create(name="asd", password="******") l.save()