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): ...@@ -583,17 +583,18 @@ def push_to_wiki(protocol, content, infobox_content, summary):
@celery.task @celery.task
def push_to_wiki_async(protocol_id, content, infobox_content, summary): 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() protocol = Protocol.query.filter_by(id=protocol_id).first()
try: try:
wiki_client.edit_page( with WikiClient() as wiki_client:
title=protocol.protocoltype.get_wiki_infobox_title(), wiki_client.edit_page(
content=infobox_content, title=protocol.protocoltype.get_wiki_infobox_title(),
summary=summary) content=infobox_content,
wiki_client.edit_page( summary=summary)
title=protocol.get_wiki_title(), wiki_client.edit_page(
content=content, title=protocol.get_wiki_title(),
summary=summary) content=content,
summary=summary)
except WikiException as exc: except WikiException as exc:
return _make_error( return _make_error(
protocol, "Pushing to Wiki", "Pushing to Wiki failed.", protocol, "Pushing to Wiki", "Pushing to Wiki failed.",
......
Supports Markdown
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