summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xfind_archived_proposals_without_template.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/find_archived_proposals_without_template.py b/find_archived_proposals_without_template.py
new file mode 100755
index 0000000..0acb4bf
--- /dev/null
+++ b/find_archived_proposals_without_template.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+"""
+Sometimes when archiving a page people accidentally also replace the
+{{Proposal page}} template, which however means that proposal.py
+won't find the page anymore. This script lists such pages so that the
+template can be manually restored.
+"""
+import pywikiapi
+import mwparserfromhell
+
+OSMWIKI_ENDPOINT = 'https://wiki.openstreetmap.org/w/api.php'
+
+osmwiki = pywikiapi.Site(OSMWIKI_ENDPOINT)
+
+for page in osmwiki.query_pages(
+ generator='categorymembers',
+ gcmtitle='Category:Archived proposals',
+ gcmlimit='max',
+ prop='templates',
+ tltemplates='Template:Proposal page'
+):
+ if not 'templates' in page:
+ print(page['title'])