def create_comment(parameters, blog_id): response = {'http_status': 400} data = {} blog = Blog(blog_id) data['comment'] = parameters.get('comment', False) data['section_id'] = parameters.get('section_id', False) if not blog.exists: response['error'] = 'blog does not exist!' return response if not data['comment'] or not data['section_id'] or data[ 'comment'] == "" or data['section_id'] == "": response['error'] = 'missing information' return response data['blog_id'] = blog_id result = blog.comment(data) if not result: response['error'] = 'comment not created' return response response.update(data) response['http_status'] = 201 return response