def decorated(*args, **kwargs): with session_scope() as session: try: currentUser = get_current_user(session) except AuthenticationError as exc: # TODO: use logger for this exception... traceback.print_exc(file=sys.stdout) return rest_authentication_error(exc) return f(session, currentUser, *args, **kwargs)
def create_data(): with session_scope() as session: if session.query(User).filter(User.username == "admin").count() != 0: return username = "******" password = "******" fullname = "admin" user = User(username, password, fullname) assert (user.checkPassword("adminpw")) session.add(user)
def create_data(): with session_scope() as session: if session.query(User).filter(User.username == "admin").count() != 0: return username = "******" password = "******" fullname = "admin" user = User(username, password, fullname) assert(user.checkPassword("adminpw")) session.add(user)