Commit 5f051d53 authored by Robin Sonnabend's avatar Robin Sonnabend
Browse files

Catch WikiException in creating the connection

/close #186

This is the reason why the errors for #107 were not reported.
Still, this does not fix pushing to MediaWiki, as the problem is on the
wiki side.
parent c0901e33
......@@ -583,17 +583,18 @@ def push_to_wiki(protocol, content, infobox_content, summary):
@celery.task
def push_to_wiki_async(protocol_id, content, infobox_content, summary):
with WikiClient() as wiki_client, app.app_context():
with app.app_context():
protocol = Protocol.query.filter_by(id=protocol_id).first()
try:
wiki_client.edit_page(
title=protocol.protocoltype.get_wiki_infobox_title(),
content=infobox_content,
summary=summary)
wiki_client.edit_page(
title=protocol.get_wiki_title(),
content=content,
summary=summary)
with WikiClient() as wiki_client:
wiki_client.edit_page(
title=protocol.protocoltype.get_wiki_infobox_title(),
content=infobox_content,
summary=summary)
wiki_client.edit_page(
title=protocol.get_wiki_title(),
content=content,
summary=summary)
except WikiException as exc:
return _make_error(
protocol, "Pushing to Wiki", "Pushing to Wiki failed.",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment