@@ -177,12 +177,13 @@ def save(self, params=None):
177177
178178 def delete (self , course_id = None ):
179179 course_key = get_course_key (self .attributes .get ("course_id" ) or course_id )
180+ course_id = str (course_key ) if course_key else None
180181 if is_forum_v2_enabled (course_key ):
181182 response = None
182183 if self .type == "comment" :
183- response = forum_api .delete_comment (comment_id = self .attributes ["id" ], course_id = str ( course_key ) )
184+ response = forum_api .delete_comment (comment_id = self .attributes ["id" ], course_id = course_id )
184185 elif self .type == "thread" :
185- response = forum_api .delete_thread (thread_id = self .attributes ["id" ], course_id = str ( course_key ) )
186+ response = forum_api .delete_thread (thread_id = self .attributes ["id" ], course_id = course_id )
186187 if response is None :
187188 raise CommentClientRequestError ("Forum v2 API call is missing" )
188189 else :
@@ -224,15 +225,16 @@ def handle_update(self, params=None):
224225 if params :
225226 request_params .update (params )
226227 course_id = self .attributes .get ("course_id" ) or request_params .get ("course_id" )
228+ course_id = str (course_id ) if course_id else None
227229 course_key = get_course_key (course_id )
228230 if is_forum_v2_enabled (course_key ):
229231 response = None
230232 if self .type == "comment" :
231- response = self .handle_update_comment (request_params , str ( course_key ) )
233+ response = self .handle_update_comment (request_params , course_id )
232234 elif self .type == "thread" :
233- response = self .handle_update_thread (request_params , str ( course_key ) )
235+ response = self .handle_update_thread (request_params , course_id )
234236 elif self .type == "user" :
235- response = self .handle_update_user (request_params , str ( course_key ) )
237+ response = self .handle_update_user (request_params , course_id )
236238 if response is None :
237239 raise CommentClientRequestError ("Forum v2 API call is missing" )
238240 else :
@@ -319,13 +321,14 @@ def perform_http_post_request(self):
319321
320322 def handle_create (self , params = None ):
321323 course_id = self .attributes .get ("course_id" ) or params .get ("course_id" )
324+ course_id = str (course_id ) if course_id else None
322325 course_key = get_course_key (course_id )
323326 if is_forum_v2_enabled (course_key ):
324327 response = None
325328 if self .type == "comment" :
326- response = self .handle_create_comment (str ( course_key ) )
329+ response = self .handle_create_comment (course_id )
327330 elif self .type == "thread" :
328- response = self .handle_create_thread (str ( course_key ) )
331+ response = self .handle_create_thread (course_id )
329332 if response is None :
330333 raise CommentClientRequestError ("Forum v2 API call is missing" )
331334 else :
0 commit comments