def delete_fragment(wikia_name, title): db_connection = get_connection(CONFIG) wikia = Wikia() try: wikia.load_by_name(db_connection, wikia_name) except WikiaNotFoundException: response.status = 200 return response fragment = Fragment() try: fragment.load_by_title(db_connection, wikia, title) except FragmentNotFoundException: response.status = 200 return response fragment.delete(db_connection) response.status = 204 return response
def get_article(wikia_name, title): db_connection = get_connection(CONFIG) wikia = Wikia() try: wikia.load_by_name(db_connection, wikia_name) except WikiaNotFoundException: response.status = 404 response.body = "Wikia not found" return response fragment = Fragment() try: fragment.load_by_title(db_connection, wikia, title) except FragmentNotFoundException: response.status = 404 response.body = "Fragment not found" return response view = FragmentView(fragment) return view.render_json()