Mattflaschen has uploaded a new change for review.
https://gerrit.wikimedia.org/r/273000
Change subject: Add script for listediting editors to a page
......................................................................
Add script for listediting editors to a page
Change-Id: Ibf71f415df2fedb93f524e9809df2f56eec12f7a
---
A scripts/listeditors.py
1 file changed, 62 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/00/273000/1
diff --git a/scripts/listeditors.py b/scripts/listeditors.py
new file mode 100755
index 0000000..ba14115
--- /dev/null
+++ b/scripts/listeditors.py
@@ -0,0 +1,62 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+"""This script will list the editors of one or more pages,
+as specified by a generator.
+
+They will be printed to stdout.
+
+-page:PAGE Page to check
+
+Usage:
+
+ python pwb.py listeditors.py -page:Earth
+
+"""
+#
+# (C) Pywikibot team, 2008-2016
+#
+# Distributed under the terms of the MIT license.
+#
+from __future__ import absolute_import, unicode_literals
+
+import pywikibot
+from pywikibot import config2 as config, i18n
+from pywikibot.pagegenerators import GeneratorFactory, parameterHelp
+
+docuReplacements = {'¶ms;': parameterHelp}
+
+def main(*args):
+ """
+ Process command line arguments and invoke script.
+
+ If args is an empty list, sys.argv is used.
+
+ @param args: command line arguments
+ @type args: list of unicode
+ """
+ page_name = None
+
+ # Process global args and prepare generator args parser
+ local_args = pywikibot.handle_args(args)
+ genFactory = GeneratorFactory()
+
+ for arg in local_args:
+ genFactory.handleArg(arg)
+
+ gen = genFactory.getCombinedGenerator()
+ if gen:
+ user_set = set()
+ for page in gen:
+ for rev in page.revisions():
+ user_set.add(rev.user)
+
+ for user_name in user_set:
+ pywikibot.stdout(user_name)
+
+ else:
+ pywikibot.bot.suggest_help(missing_generator=True)
+ return False
+
+
+if __name__ == "__main__":
+ main()
--
To view, visit https://gerrit.wikimedia.org/r/273000
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf71f415df2fedb93f524e9809df2f56eec12f7a
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits