def fetch_content(): """ Extract the forum object from the keyword arguments to the view. """ user_group_id = None content_user_group_id = None if "thread_id" in kwargs: content = cc.Thread.find(kwargs["thread_id"]).to_dict() elif "comment_id" in kwargs: content = cc.Comment.find(kwargs["comment_id"]).to_dict() elif "commentable_id" in kwargs: content = cc.Commentable.find(kwargs["commentable_id"]).to_dict() else: content = None if 'username' in content: (user_group_id, content_user_group_id) = get_user_group_ids(course_key, content, request.user) return content, user_group_id, content_user_group_id