예제 #1
0
	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)
예제 #2
0
    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)
예제 #3
0
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)
예제 #4
0
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)