[MediaWiki-commits] [Gerrit] Ported pagefromfile.py to core - change (pywikibot/core)

2013-11-22 Thread Mayankmadan (Code Review)
Mayankmadan has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/96964


Change subject: Ported pagefromfile.py to core
..

Ported pagefromfile.py to core

Bug: 56897
Change-Id: Id238d86cd72851b027c9c0b5bd20fa0da41d5f13
---
A scripts/pagefromfile.py
1 file changed, 367 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/64/96964/1

diff --git a/scripts/pagefromfile.py b/scripts/pagefromfile.py
new file mode 100644
index 000..80c0c00
--- /dev/null
+++ b/scripts/pagefromfile.py
@@ -0,0 +1,367 @@
+#!/usr/bin/python
+#coding: utf-8
+
+This bot takes its input from a file that contains a number of
+pages to be put on the wiki. The pages should all have the same
+begin and end text (which may not overlap).
+
+By default the text should have the intended title of the page
+as the first text in bold (that is, between ''' and '''),
+you can modify this behavior with command line options.
+
+The default is not to include the begin and
+end text in the page, if you want to include that text, use
+the -include option.
+
+Specific arguments:
+-start:xxx  Specify the text that marks the beginning of a page
+-end:xxxSpecify the text that marks the end of a page
+-file:xxx   Give the filename we are getting our material from
+-includeThe beginning and end markers should be included
+in the page.
+-titlestart:xxx Use xxx in place of ''' for identifying the
+beginning of page title
+-titleend:xxx   Use xxx in place of ''' for identifying the
+end of page title
+-notitledo not include the title, including titlestart, and
+titleend, in the page
+-nocontent  If page has this statment it dosen't append
+(example: -nocontents:{{infobox)
+-summary:xxxUse xxx as the edit summary for the upload - if
+a page exists, standard messages are appended
+after xxx for appending, prepending, or replacement
+-autosummaryUse MediaWikis autosummary when creating a new page,
+overrides -summary in this case
+-minor  set minor edit flag on page edits
+
+If the page to be uploaded already exists:
+-safe   do nothing (default)
+-appendtop  add the text to the top of it
+-appendbottom   add the text to the bottom of it
+-force  overwrite the existing page
+
+#
+# (C) Andre Engels, 2004
+# (C) Pywikipedia bot team, 2005-2010
+#
+# Distributed under the terms of the MIT license.
+#
+__version__='$Id$'
+#
+
+import re, codecs
+import pywikibot
+from pywikibot import config
+
+class NoTitle(Exception):
+No title found
+def __init__(self, offset):
+self.offset = offset
+
+class PageFromFileRobot:
+
+Responsible for writing pages to the wiki, with the titles and contents
+given by a PageFromFileReader.
+
+
+msg = {
+'ar': u'استيراد تلقائي للمقالات',
+'de': u'Automatischer Import von Artikeln',
+'en': u'Automated import of articles',
+'fa': u'درون‌ریزی خودکار مقاله‌ها',
+'fr': u'Import automatique',
+'he': u'ייבוא ערכים אוטומטי',
+'ia': u'Importation automatic de articulos',
+'id': u'Impor artikel automatis',
+'it': u'Caricamento automatico',
+'ja': u'記事の自動取り込み',
+'ksh': u'Bot: automatesch huhjelaade',
+'mzn': u'ربوت:صفحه شه خاد به خاد دله دکته',
+'nl': u'Geautomatiseerde import',
+'no': u'bot: Automatisk import',
+'pl': u'Automatyczny import artykułów',
+'pt': u'Importação automática de artigos',
+'uk': u'Автоматичний імпорт статей',
+'zh': u'機器人: 自動匯入頁面',
+}
+
+# The following messages are added to topic when the page already exists
+msg_top = {
+'ar': u'كتابة على الأعلى',
+'de': u'ergänze am Anfang',
+'en': u'append on top',
+'fa': u'به بالا اضافه شد',
+'he': u'הוספה בראש הדף',
+'fr': u'rajouté en haut',
+'id': u'ditambahkan di atas',
+'it': u'aggiungo in cima',
+'ja': u'冒頭への追加',
+'ksh': u'un dofüürjesaz',
+'nl': u'bovenaan toegevoegd',
+'no': u'legger til øverst',
+'pl': u'dodaj na górze',
+'pt': u'adicionado no topo',
+'uk': u'додано зверху',
+'zh': u'機器人: 增加至最上層',
+}
+
+msg_bottom = {
+'ar': u'كتابة على الأسفل',
+'de': u'ergänze am Ende',
+'en': u'append on bottom',
+'fa': u'به پایین اضافه شد',
+'he': u'הוספה בתחתית הדף',
+'fr': u'rajouté en bas',
+'id': u'ditambahkan di bawah',
+'it': u'aggiungo in fondo',
+'ja': u'末尾への追加',
+'ksh': u'un aanjehange',
+'nl': u'onderaan toegevoegd',
+'no': u'legger til nederst',
+'pl': u'dodaj na dole',
+'pt': u'adicionando no fim',
+'uk': 

[MediaWiki-commits] [Gerrit] Ported pagefromfile.py to core - change (pywikibot/core)

2013-11-22 Thread Strainu (Code Review)
Strainu has submitted this change and it was merged.

Change subject: Ported pagefromfile.py to core
..


Ported pagefromfile.py to core

Bug: 56897
Change-Id: Id238d86cd72851b027c9c0b5bd20fa0da41d5f13
---
A scripts/pagefromfile.py
1 file changed, 371 insertions(+), 0 deletions(-)

Approvals:
  Strainu: Verified; Looks good to me, approved
  jenkins-bot: Checked



diff --git a/scripts/pagefromfile.py b/scripts/pagefromfile.py
new file mode 100644
index 000..02f1fc5
--- /dev/null
+++ b/scripts/pagefromfile.py
@@ -0,0 +1,371 @@
+#!/usr/bin/python
+#coding: utf-8
+
+This bot takes its input from a file that contains a number of
+pages to be put on the wiki. The pages should all have the same
+begin and end text (which may not overlap).
+
+By default the text should have the intended title of the page
+as the first text in bold (that is, between ''' and '''),
+you can modify this behavior with command line options.
+
+The default is not to include the begin and
+end text in the page, if you want to include that text, use
+the -include option.
+
+Specific arguments:
+-start:xxx  Specify the text that marks the beginning of a page
+-end:xxxSpecify the text that marks the end of a page
+-file:xxx   Give the filename we are getting our material from
+-includeThe beginning and end markers should be included
+in the page.
+-titlestart:xxx Use xxx in place of ''' for identifying the
+beginning of page title
+-titleend:xxx   Use xxx in place of ''' for identifying the
+end of page title
+-notitledo not include the title, including titlestart, and
+titleend, in the page
+-nocontent  If page has this statment it dosen't append
+(example: -nocontents:{{infobox)
+-summary:xxxUse xxx as the edit summary for the upload - if
+a page exists, standard messages are appended
+after xxx for appending, prepending, or replacement
+-autosummaryUse MediaWikis autosummary when creating a new page,
+overrides -summary in this case
+-minor  set minor edit flag on page edits
+
+If the page to be uploaded already exists:
+-safe   do nothing (default)
+-appendtop  add the text to the top of it
+-appendbottom   add the text to the bottom of it
+-force  overwrite the existing page
+
+#
+# (C) Andre Engels, 2004
+# (C) Pywikipedia bot team, 2005-2010
+#
+# Distributed under the terms of the MIT license.
+#
+__version__ = '$Id$'
+#
+
+import re
+import codecs
+import pywikibot
+from pywikibot import config
+
+
+class NoTitle(Exception):
+No title found
+def __init__(self, offset):
+self.offset = offset
+
+
+class PageFromFileRobot:
+
+Responsible for writing pages to the wiki, with the titles and contents
+given by a PageFromFileReader.
+
+
+msg = {
+'ar': u'استيراد تلقائي للمقالات',
+'de': u'Automatischer Import von Artikeln',
+'en': u'Automated import of articles',
+'fa': u'درون‌ریزی خودکار مقاله‌ها',
+'fr': u'Import automatique',
+'he': u'ייבוא ערכים אוטומטי',
+'ia': u'Importation automatic de articulos',
+'id': u'Impor artikel automatis',
+'it': u'Caricamento automatico',
+'ja': u'記事の自動取り込み',
+'ksh': u'Bot: automatesch huhjelaade',
+'mzn': u'ربوت:صفحه شه خاد به خاد دله دکته',
+'nl': u'Geautomatiseerde import',
+'no': u'bot: Automatisk import',
+'pl': u'Automatyczny import artykułów',
+'pt': u'Importação automática de artigos',
+'uk': u'Автоматичний імпорт статей',
+'zh': u'機器人: 自動匯入頁面',
+}
+
+# The following messages are added to topic when the page already exists
+msg_top = {
+'ar': u'كتابة على الأعلى',
+'de': u'ergänze am Anfang',
+'en': u'append on top',
+'fa': u'به بالا اضافه شد',
+'he': u'הוספה בראש הדף',
+'fr': u'rajouté en haut',
+'id': u'ditambahkan di atas',
+'it': u'aggiungo in cima',
+'ja': u'冒頭への追加',
+'ksh': u'un dofüürjesaz',
+'nl': u'bovenaan toegevoegd',
+'no': u'legger til øverst',
+'pl': u'dodaj na górze',
+'pt': u'adicionado no topo',
+'uk': u'додано зверху',
+'zh': u'機器人: 增加至最上層',
+}
+
+msg_bottom = {
+'ar': u'كتابة على الأسفل',
+'de': u'ergänze am Ende',
+'en': u'append on bottom',
+'fa': u'به پایین اضافه شد',
+'he': u'הוספה בתחתית הדף',
+'fr': u'rajouté en bas',
+'id': u'ditambahkan di bawah',
+'it': u'aggiungo in fondo',
+'ja': u'末尾への追加',
+'ksh': u'un aanjehange',
+'nl': u'onderaan toegevoegd',
+'no': u'legger til nederst',
+'pl': u'dodaj na dole',
+'pt': u'adicionando no fim',
+'uk': u'додано знизу',
+