def change_username(self, user: User, new_username: str) -> None: with self._session_cm as scm: user.username = new_username scm.session.commit()
def change_username(self, user: User, new_username: str) -> None: # Update the mapping from username to user id del self._user_id_map[user.username] self._user_id_map[new_username] = user.id user.username = new_username