We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
If speaker edit their profile or session they are unassigned
If speaker edit their profile or session they are unassigned from their session. Result: Organizer needs to re-add them to the session.

Expected: If speaker edit profile or session nothing should change. Sessions should still have the same speaker and same status.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `app/views/users/my_sessions.py`
Content:
```
1 import json
2 from datetime import datetime
3 
4 from flask import Blueprint, jsonify
5 from flask import flash, redirect, url_for, request
6 from flask import render_template
7 from flask.ext.restplus import abort
8 from flask.ext import login
9 from markupsafe import Markup
10 
11 from app.helpers.data import DataManager, save_to_db
12 from app.helpers.data_getter import DataGetter
13 from app.helpers.auth import AuthManager
14 
15 my_sessions = Blueprint('my_sessions', __name__, url_prefix='/events/mysessions')
16 
17 
18 @my_sessions.route('/')
19 def display_my_sessions_view():
20     placeholder_images = DataGetter.get_event_default_images()
21     custom_placeholder = DataGetter.get_custom_placeholders()
22     upcoming_events_sessions = DataGetter.get_sessions_of_user(upcoming_events=True)
23     im_config = DataGetter.get_image_configs()
24     im_size = ''
25     for config in im_config:
26         if config.page == 'mysession':
27             im_size = config.size
28     past_events_sessions = DataGetter.get_sessions_of_user(upcoming_events=False)
29     page_content = {"tab_upcoming_events": "Upcoming Sessions",
30                     "tab_past_events": "Past Sessions",
31                     "title": "My Session Proposals"}
32     if not AuthManager.is_verified_user():
33         flash(Markup("Your account is unverified. "
34                      "Please verify by clicking on the confirmation link that has been emailed to you."
35                      '<br>Did not get the email? Please <a href="/resend_email/" class="alert-link"> '
36                      'click here to resend the confirmation.</a>'))
37     return render_template('gentelella/users/mysessions/mysessions_list.html',
38                            upcoming_events_sessions=upcoming_events_sessions,
39                            past_events_sessions=past_events_sessions,
40                            page_content=page_content,
41                            placeholder_images=placeholder_images,
42                            custom_placeholder=custom_placeholder,
43                            im_size=im_size)
44 
45 
46 @my_sessions.route('/<int:session_id>/')
47 def display_session_view(session_id):
48     session = DataGetter.get_sessions_of_user_by_id(session_id)
49     if not session:
50         abort(404)
51     form_elems = DataGetter.get_custom_form_elements(session.event_id)
52     if not form_elems:
53         flash("Speaker and Session forms have been incorrectly configured for this event."
54               " Session creation has been disabled", "danger")
55         return redirect(url_for('.display_my_sessions_view', event_id=session.event_id))
56     speaker_form = json.loads(form_elems.speaker_form)
57     session_form = json.loads(form_elems.session_form)
58     event = DataGetter.get_event(session.event_id)
59     speakers = DataGetter.get_speakers(session.event_id).all()
60     user_speaker = DataGetter.get_speakers(session.event_id).filter_by(user_id=login.current_user.id).first()
61     return render_template('gentelella/users/mysessions/mysession_detail.html',
62                            session=session,
63                            speaker_form=speaker_form,
64                            session_form=session_form,
65                            event=event,
66                            speakers=speakers,
67                            user_speaker=user_speaker)
68 
69 
70 @my_sessions.route('/<int:session_id>/session-edit/', methods=('POST', 'GET'))
71 def process_session_view(session_id):
72     if request.method == 'GET':
73         session = DataGetter.get_sessions_of_user_by_id(session_id)
74         speaker = DataGetter.get_speakers(session.event_id).filter_by(user_id=login.current_user.id).first()
75         if not session:
76             abort(404)
77         form_elems = DataGetter.get_custom_form_elements(session.event_id)
78         if not form_elems:
79             flash("Speaker and Session forms have been incorrectly configured for this event."
80                   " Session creation has been disabled", "danger")
81             return redirect(url_for('.display_my_sessions_view', event_id=session.event_id))
82         session_form = json.loads(form_elems.session_form)
83         event = DataGetter.get_event(session.event_id)
84         return render_template(
85             'gentelella/users/mysessions/mysession_session_edit.html',
86             session=session,
87             speaker=speaker,
88             session_form=session_form,
89             event=event)
90 
91     if request.method == 'POST':
92         session = DataGetter.get_sessions_of_user_by_id(session_id)
93         speaker = DataGetter.get_speakers(session.event_id).filter_by(user_id=login.current_user.id).first()
94         DataManager.edit_session(request, session, speaker)
95         flash("The session has been updated successfully", "success")
96         return redirect(url_for('.display_session_view', session_id=session_id))
97 
98 
99 @my_sessions.route('/<int:speaker_id>/speaker-edit/', methods=('POST', 'GET'))
100 def process_speaker_view(speaker_id):
101     if request.method == 'GET':
102         speaker = DataGetter.get_speaker(speaker_id)
103         if not speaker or speaker.name == '':
104             abort(404)
105         form_elems = DataGetter.get_custom_form_elements(speaker.event_id)
106         if not form_elems:
107             flash("Speaker and Session forms have been incorrectly configured for this event."
108                   " Session creation has been disabled", "danger")
109             return redirect(url_for('.display_my_sessions_view', event_id=speaker.event_id))
110         speaker_form = json.loads(form_elems.speaker_form)
111         event = DataGetter.get_event(speaker.event_id)
112         return render_template(
113             'gentelella/users/mysessions/mysession_speaker_edit.html',
114             photo_delete_url=url_for('.avatar_delete',
115             event_id=event.id,
116             speaker_id=speaker.id),
117             speaker_form=speaker_form,
118             event=event,
119             speaker=speaker)
120 
121     if request.method == 'POST':
122         speaker = DataGetter.get_speaker(speaker_id)
123         DataManager.edit_speaker(request, speaker)
124         flash("The speaker has been updated successfully", "success")
125         return redirect(url_for('.display_my_sessions_view', event_id=speaker.event_id))
126 
127 
128 @my_sessions.route('/<int:event_id>/speakers/<int:speaker_id>/avatar', methods=('DELETE',))
129 def avatar_delete(event_id, speaker_id):
130     if request.method == 'DELETE':
131         speaker = DataGetter.get_speakers(event_id).filter_by(user_id=login.current_user.id, id=speaker_id).first()
132         if speaker:
133             speaker.photo = ''
134             speaker.small = ''
135             speaker.thumbnail = ''
136             speaker.icon = ''
137             save_to_db(speaker)
138             return jsonify({'status': 'ok'})
139         else:
140             abort(403)
141 
142 
143 @my_sessions.route('/<int:session_id>/withdraw/')
144 def withdraw_session_view(session_id):
145     session = DataGetter.get_sessions_of_user_by_id(session_id)
146     session.deleted_at = datetime.now()
147     save_to_db(session)
148     flash("The session has been withdrawn", "success")
149     return redirect(url_for('.display_my_sessions_view', session_id=session_id))
150
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/app/views/users/my_sessions.py b/app/views/users/my_sessions.py
--- a/app/views/users/my_sessions.py
+++ b/app/views/users/my_sessions.py
@@ -81,12 +81,14 @@
             return redirect(url_for('.display_my_sessions_view', event_id=session.event_id))
         session_form = json.loads(form_elems.session_form)
         event = DataGetter.get_event(session.event_id)
+        speakers = DataGetter.get_speakers(session.event_id).all()
         return render_template(
             'gentelella/users/mysessions/mysession_session_edit.html',
             session=session,
             speaker=speaker,
             session_form=session_form,
-            event=event)
+            event=event,
+            speakers=speakers)
 
     if request.method == 'POST':
         session = DataGetter.get_sessions_of_user_by_id(session_id)

{"golden_diff": "diff --git a/app/views/users/my_sessions.py b/app/views/users/my_sessions.py\n--- a/app/views/users/my_sessions.py\n+++ b/app/views/users/my_sessions.py\n@@ -81,12 +81,14 @@\n             return redirect(url_for('.display_my_sessions_view', event_id=session.event_id))\n         session_form = json.loads(form_elems.session_form)\n         event = DataGetter.get_event(session.event_id)\n+        speakers = DataGetter.get_speakers(session.event_id).all()\n         return render_template(\n             'gentelella/users/mysessions/mysession_session_edit.html',\n             session=session,\n             speaker=speaker,\n             session_form=session_form,\n-            event=event)\n+            event=event,\n+            speakers=speakers)\n \n     if request.method == 'POST':\n         session = DataGetter.get_sessions_of_user_by_id(session_id)\n", "issue": "If speaker edit their profile or session they are unassigned\nIf speaker edit their profile or session they are unassigned from their session. Result: Organizer needs to re-add them to the session.\r\n\r\nExpected: If speaker edit profile or session nothing should change. Sessions should still have the same speaker and same status.\n", "before_files": [{"content": "import json\nfrom datetime import datetime\n\nfrom flask import Blueprint, jsonify\nfrom flask import flash, redirect, url_for, request\nfrom flask import render_template\nfrom flask.ext.restplus import abort\nfrom flask.ext import login\nfrom markupsafe import Markup\n\nfrom app.helpers.data import DataManager, save_to_db\nfrom app.helpers.data_getter import DataGetter\nfrom app.helpers.auth import AuthManager\n\nmy_sessions = Blueprint('my_sessions', __name__, url_prefix='/events/mysessions')\n\n\n@my_sessions.route('/')\ndef display_my_sessions_view():\n    placeholder_images = DataGetter.get_event_default_images()\n    custom_placeholder = DataGetter.get_custom_placeholders()\n    upcoming_events_sessions = DataGetter.get_sessions_of_user(upcoming_events=True)\n    im_config = DataGetter.get_image_configs()\n    im_size = ''\n    for config in im_config:\n        if config.page == 'mysession':\n            im_size = config.size\n    past_events_sessions = DataGetter.get_sessions_of_user(upcoming_events=False)\n    page_content = {\"tab_upcoming_events\": \"Upcoming Sessions\",\n                    \"tab_past_events\": \"Past Sessions\",\n                    \"title\": \"My Session Proposals\"}\n    if not AuthManager.is_verified_user():\n        flash(Markup(\"Your account is unverified. \"\n                     \"Please verify by clicking on the confirmation link that has been emailed to you.\"\n                     '<br>Did not get the email? Please <a href=\"/resend_email/\" class=\"alert-link\"> '\n                     'click here to resend the confirmation.</a>'))\n    return render_template('gentelella/users/mysessions/mysessions_list.html',\n                           upcoming_events_sessions=upcoming_events_sessions,\n                           past_events_sessions=past_events_sessions,\n                           page_content=page_content,\n                           placeholder_images=placeholder_images,\n                           custom_placeholder=custom_placeholder,\n                           im_size=im_size)\n\n\n@my_sessions.route('/<int:session_id>/')\ndef display_session_view(session_id):\n    session = DataGetter.get_sessions_of_user_by_id(session_id)\n    if not session:\n        abort(404)\n    form_elems = DataGetter.get_custom_form_elements(session.event_id)\n    if not form_elems:\n        flash(\"Speaker and Session forms have been incorrectly configured for this event.\"\n              \" Session creation has been disabled\", \"danger\")\n        return redirect(url_for('.display_my_sessions_view', event_id=session.event_id))\n    speaker_form = json.loads(form_elems.speaker_form)\n    session_form = json.loads(form_elems.session_form)\n    event = DataGetter.get_event(session.event_id)\n    speakers = DataGetter.get_speakers(session.event_id).all()\n    user_speaker = DataGetter.get_speakers(session.event_id).filter_by(user_id=login.current_user.id).first()\n    return render_template('gentelella/users/mysessions/mysession_detail.html',\n                           session=session,\n                           speaker_form=speaker_form,\n                           session_form=session_form,\n                           event=event,\n                           speakers=speakers,\n                           user_speaker=user_speaker)\n\n\n@my_sessions.route('/<int:session_id>/session-edit/', methods=('POST', 'GET'))\ndef process_session_view(session_id):\n    if request.method == 'GET':\n        session = DataGetter.get_sessions_of_user_by_id(session_id)\n        speaker = DataGetter.get_speakers(session.event_id).filter_by(user_id=login.current_user.id).first()\n        if not session:\n            abort(404)\n        form_elems = DataGetter.get_custom_form_elements(session.event_id)\n        if not form_elems:\n            flash(\"Speaker and Session forms have been incorrectly configured for this event.\"\n                  \" Session creation has been disabled\", \"danger\")\n            return redirect(url_for('.display_my_sessions_view', event_id=session.event_id))\n        session_form = json.loads(form_elems.session_form)\n        event = DataGetter.get_event(session.event_id)\n        return render_template(\n            'gentelella/users/mysessions/mysession_session_edit.html',\n            session=session,\n            speaker=speaker,\n            session_form=session_form,\n            event=event)\n\n    if request.method == 'POST':\n        session = DataGetter.get_sessions_of_user_by_id(session_id)\n        speaker = DataGetter.get_speakers(session.event_id).filter_by(user_id=login.current_user.id).first()\n        DataManager.edit_session(request, session, speaker)\n        flash(\"The session has been updated successfully\", \"success\")\n        return redirect(url_for('.display_session_view', session_id=session_id))\n\n\n@my_sessions.route('/<int:speaker_id>/speaker-edit/', methods=('POST', 'GET'))\ndef process_speaker_view(speaker_id):\n    if request.method == 'GET':\n        speaker = DataGetter.get_speaker(speaker_id)\n        if not speaker or speaker.name == '':\n            abort(404)\n        form_elems = DataGetter.get_custom_form_elements(speaker.event_id)\n        if not form_elems:\n            flash(\"Speaker and Session forms have been incorrectly configured for this event.\"\n                  \" Session creation has been disabled\", \"danger\")\n            return redirect(url_for('.display_my_sessions_view', event_id=speaker.event_id))\n        speaker_form = json.loads(form_elems.speaker_form)\n        event = DataGetter.get_event(speaker.event_id)\n        return render_template(\n            'gentelella/users/mysessions/mysession_speaker_edit.html',\n            photo_delete_url=url_for('.avatar_delete',\n            event_id=event.id,\n            speaker_id=speaker.id),\n            speaker_form=speaker_form,\n            event=event,\n            speaker=speaker)\n\n    if request.method == 'POST':\n        speaker = DataGetter.get_speaker(speaker_id)\n        DataManager.edit_speaker(request, speaker)\n        flash(\"The speaker has been updated successfully\", \"success\")\n        return redirect(url_for('.display_my_sessions_view', event_id=speaker.event_id))\n\n\n@my_sessions.route('/<int:event_id>/speakers/<int:speaker_id>/avatar', methods=('DELETE',))\ndef avatar_delete(event_id, speaker_id):\n    if request.method == 'DELETE':\n        speaker = DataGetter.get_speakers(event_id).filter_by(user_id=login.current_user.id, id=speaker_id).first()\n        if speaker:\n            speaker.photo = ''\n            speaker.small = ''\n            speaker.thumbnail = ''\n            speaker.icon = ''\n            save_to_db(speaker)\n            return jsonify({'status': 'ok'})\n        else:\n            abort(403)\n\n\n@my_sessions.route('/<int:session_id>/withdraw/')\ndef withdraw_session_view(session_id):\n    session = DataGetter.get_sessions_of_user_by_id(session_id)\n    session.deleted_at = datetime.now()\n    save_to_db(session)\n    flash(\"The session has been withdrawn\", \"success\")\n    return redirect(url_for('.display_my_sessions_view', session_id=session_id))\n", "path": "app/views/users/my_sessions.py"}], "after_files": [{"content": "import json\nfrom datetime import datetime\n\nfrom flask import Blueprint, jsonify\nfrom flask import flash, redirect, url_for, request\nfrom flask import render_template\nfrom flask.ext.restplus import abort\nfrom flask.ext import login\nfrom markupsafe import Markup\n\nfrom app.helpers.data import DataManager, save_to_db\nfrom app.helpers.data_getter import DataGetter\nfrom app.helpers.auth import AuthManager\n\nmy_sessions = Blueprint('my_sessions', __name__, url_prefix='/events/mysessions')\n\n\n@my_sessions.route('/')\ndef display_my_sessions_view():\n    placeholder_images = DataGetter.get_event_default_images()\n    custom_placeholder = DataGetter.get_custom_placeholders()\n    upcoming_events_sessions = DataGetter.get_sessions_of_user(upcoming_events=True)\n    im_config = DataGetter.get_image_configs()\n    im_size = ''\n    for config in im_config:\n        if config.page == 'mysession':\n            im_size = config.size\n    past_events_sessions = DataGetter.get_sessions_of_user(upcoming_events=False)\n    page_content = {\"tab_upcoming_events\": \"Upcoming Sessions\",\n                    \"tab_past_events\": \"Past Sessions\",\n                    \"title\": \"My Session Proposals\"}\n    if not AuthManager.is_verified_user():\n        flash(Markup(\"Your account is unverified. \"\n                     \"Please verify by clicking on the confirmation link that has been emailed to you.\"\n                     '<br>Did not get the email? Please <a href=\"/resend_email/\" class=\"alert-link\"> '\n                     'click here to resend the confirmation.</a>'))\n    return render_template('gentelella/users/mysessions/mysessions_list.html',\n                           upcoming_events_sessions=upcoming_events_sessions,\n                           past_events_sessions=past_events_sessions,\n                           page_content=page_content,\n                           placeholder_images=placeholder_images,\n                           custom_placeholder=custom_placeholder,\n                           im_size=im_size)\n\n\n@my_sessions.route('/<int:session_id>/')\ndef display_session_view(session_id):\n    session = DataGetter.get_sessions_of_user_by_id(session_id)\n    if not session:\n        abort(404)\n    form_elems = DataGetter.get_custom_form_elements(session.event_id)\n    if not form_elems:\n        flash(\"Speaker and Session forms have been incorrectly configured for this event.\"\n              \" Session creation has been disabled\", \"danger\")\n        return redirect(url_for('.display_my_sessions_view', event_id=session.event_id))\n    speaker_form = json.loads(form_elems.speaker_form)\n    session_form = json.loads(form_elems.session_form)\n    event = DataGetter.get_event(session.event_id)\n    speakers = DataGetter.get_speakers(session.event_id).all()\n    user_speaker = DataGetter.get_speakers(session.event_id).filter_by(user_id=login.current_user.id).first()\n    return render_template('gentelella/users/mysessions/mysession_detail.html',\n                           session=session,\n                           speaker_form=speaker_form,\n                           session_form=session_form,\n                           event=event,\n                           speakers=speakers,\n                           user_speaker=user_speaker)\n\n\n@my_sessions.route('/<int:session_id>/session-edit/', methods=('POST', 'GET'))\ndef process_session_view(session_id):\n    if request.method == 'GET':\n        session = DataGetter.get_sessions_of_user_by_id(session_id)\n        speaker = DataGetter.get_speakers(session.event_id).filter_by(user_id=login.current_user.id).first()\n        if not session:\n            abort(404)\n        form_elems = DataGetter.get_custom_form_elements(session.event_id)\n        if not form_elems:\n            flash(\"Speaker and Session forms have been incorrectly configured for this event.\"\n                  \" Session creation has been disabled\", \"danger\")\n            return redirect(url_for('.display_my_sessions_view', event_id=session.event_id))\n        session_form = json.loads(form_elems.session_form)\n        event = DataGetter.get_event(session.event_id)\n        speakers = DataGetter.get_speakers(session.event_id).all()\n        return render_template(\n            'gentelella/users/mysessions/mysession_session_edit.html',\n            session=session,\n            speaker=speaker,\n            session_form=session_form,\n            event=event,\n            speakers=speakers)\n\n    if request.method == 'POST':\n        session = DataGetter.get_sessions_of_user_by_id(session_id)\n        speaker = DataGetter.get_speakers(session.event_id).filter_by(user_id=login.current_user.id).first()\n        DataManager.edit_session(request, session, speaker)\n        flash(\"The session has been updated successfully\", \"success\")\n        return redirect(url_for('.display_session_view', session_id=session_id))\n\n\n@my_sessions.route('/<int:speaker_id>/speaker-edit/', methods=('POST', 'GET'))\ndef process_speaker_view(speaker_id):\n    if request.method == 'GET':\n        speaker = DataGetter.get_speaker(speaker_id)\n        if not speaker or speaker.name == '':\n            abort(404)\n        form_elems = DataGetter.get_custom_form_elements(speaker.event_id)\n        if not form_elems:\n            flash(\"Speaker and Session forms have been incorrectly configured for this event.\"\n                  \" Session creation has been disabled\", \"danger\")\n            return redirect(url_for('.display_my_sessions_view', event_id=speaker.event_id))\n        speaker_form = json.loads(form_elems.speaker_form)\n        event = DataGetter.get_event(speaker.event_id)\n        return render_template(\n            'gentelella/users/mysessions/mysession_speaker_edit.html',\n            photo_delete_url=url_for('.avatar_delete',\n            event_id=event.id,\n            speaker_id=speaker.id),\n            speaker_form=speaker_form,\n            event=event,\n            speaker=speaker)\n\n    if request.method == 'POST':\n        speaker = DataGetter.get_speaker(speaker_id)\n        DataManager.edit_speaker(request, speaker)\n        flash(\"The speaker has been updated successfully\", \"success\")\n        return redirect(url_for('.display_my_sessions_view', event_id=speaker.event_id))\n\n\n@my_sessions.route('/<int:event_id>/speakers/<int:speaker_id>/avatar', methods=('DELETE',))\ndef avatar_delete(event_id, speaker_id):\n    if request.method == 'DELETE':\n        speaker = DataGetter.get_speakers(event_id).filter_by(user_id=login.current_user.id, id=speaker_id).first()\n        if speaker:\n            speaker.photo = ''\n            speaker.small = ''\n            speaker.thumbnail = ''\n            speaker.icon = ''\n            save_to_db(speaker)\n            return jsonify({'status': 'ok'})\n        else:\n            abort(403)\n\n\n@my_sessions.route('/<int:session_id>/withdraw/')\ndef withdraw_session_view(session_id):\n    session = DataGetter.get_sessions_of_user_by_id(session_id)\n    session.deleted_at = datetime.now()\n    save_to_db(session)\n    flash(\"The session has been withdrawn\", \"success\")\n    return redirect(url_for('.display_my_sessions_view', session_id=session_id))\n", "path": "app/views/users/my_sessions.py"}]}