示例#1
0
文件: main.py 项目: PlatonGit/blog2
def main():
    db = DbService()

    user_repo = UserRepository(db)
    profile_repo = ProfileRepository(db)
    post_repo = PostRepository(db)

    user_controller = UserController(user_repo)
    profile_controller = ProfileController(profile_repo)
    post_controller = PostController(post_repo)

    app = StartMenu(user_controller, profile_controller, post_controller)

    try:
        app.display()
    except UserExitException:
        print(
            '\n\n=================================================\nExiting the programm; closing connection with database.\nThank you for using this software and goodbye!'
        )
        db = DbService()
        db.close()
示例#2
0
文件: main.py 项目: PlatonGit/blog2
    user_repo = UserRepository(db)
    profile_repo = ProfileRepository(db)
    post_repo = PostRepository(db)

    user_controller = UserController(user_repo)
    profile_controller = ProfileController(profile_repo)
    post_controller = PostController(post_repo)

    app = StartMenu(user_controller, profile_controller, post_controller)

    try:
        app.display()
    except UserExitException:
        print(
            '\n\n=================================================\nExiting the programm; closing connection with database.\nThank you for using this software and goodbye!'
        )
        db = DbService()
        db.close()


if __name__ == '__main__':
    try:
        main()
    except KeyboardInterrupt:
        print(
            '\n\n=================================================\nForced programm shutdown; closing connection with database.\nThank you for using this software and goodbye!'
        )
        db = DbService()
        db.close()