From 83a4dbd3321bb05378724bcce13c3d2db47fcc68 Mon Sep 17 00:00:00 2001 From: Frisk Date: Tue, 29 Dec 2020 23:26:59 +0100 Subject: [PATCH] Fix compatibility with Special:ProtectSite #188 --- src/rc_formatters.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rc_formatters.py b/src/rc_formatters.py index 1e1a004..df5d544 100644 --- a/src/rc_formatters.py +++ b/src/rc_formatters.py @@ -308,7 +308,7 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes link = link_formatter(create_article_path(change["title"])) content = _("[{author}]({author_url}) protected [{article}]({article_url}) with the following settings: {settings}{comment}").format(author=author, author_url=author_url, article=change["title"], article_url=link, - settings=change["logparams"]["description"]+(_(" [cascading]") if "cascade" in change["logparams"] else ""), + settings=change["logparams"].get("description", "")+(_(" [cascading]") if "cascade" in change["logparams"] else ""), comment=parsed_comment) elif action == "protect/modify": link = link_formatter(create_article_path(change["title"])) @@ -316,7 +316,7 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes "[{author}]({author_url}) modified protection settings of [{article}]({article_url}) to: {settings}{comment}").format( author=author, author_url=author_url, article=change["title"], article_url=link, - settings=change["logparams"]["description"] + (_(" [cascading]") if "cascade" in change["logparams"] else ""), + settings=change["logparams"].get("description", "") + (_(" [cascading]") if "cascade" in change["logparams"] else ""), comment=parsed_comment) elif action == "protect/unprotect": link = link_formatter(create_article_path(change["title"])) @@ -978,13 +978,13 @@ def embed_formatter(action, change, parsed_comment, categories, recent_changes): elif action == "protect/protect": link = create_article_path(change["title"]) embed["title"] = _("Protected {target}").format(target=change["title"]) - parsed_comment = "{settings}{cascade} | {reason}".format(settings=change["logparams"]["description"], + parsed_comment = "{settings}{cascade} | {reason}".format(settings=change["logparams"].get("description", ""), cascade=_(" [cascading]") if "cascade" in change["logparams"] else "", reason=parsed_comment) elif action == "protect/modify": link = create_article_path(change["title"]) embed["title"] = _("Changed protection level for {article}").format(article=change["title"]) - parsed_comment = "{settings}{cascade} | {reason}".format(settings=change["logparams"]["description"], + parsed_comment = "{settings}{cascade} | {reason}".format(settings=change["logparams"].get("description", ""), cascade=_(" [cascading]") if "cascade" in change["logparams"] else "", reason=parsed_comment) elif action == "protect/unprotect":