jenkins-bot has submitted this change and it was merged.
Change subject: Noisy dots for fixing moved page redirects.
......................................................................
Noisy dots for fixing moved page redirects.
Otherwise you didn't see any action for a long period and cannot
check whether the bot works or e.g. hangs. Single dots are printed.
Because the print statement prints a space on the end (py 2.X), there
has to be a backspace char "\b" in front of the next dot.
(unlike compat where you see any retrieved page)
Change-Id: Id6ce19608e86b50d1720acb98d010c9b05dcb27e
---
M scripts/redirect.py
1 file changed, 2 insertions(+), 0 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/redirect.py b/scripts/redirect.py
index f2eec79..d8451f0 100755
--- a/scripts/redirect.py
+++ b/scripts/redirect.py
@@ -348,8 +348,10 @@
move_gen = self.site.logevents(logtype="move", start=offset_time)
if self.api_number:
move_gen.set_maximum_items(self.api_number)
+ pywikibot.output('.', newline=False)
for logentry in move_gen:
moved_page = logentry.title()
+ pywikibot.output('.', newline=False)
try:
if not moved_page.isRedirectPage():
continue
--
To view, visit https://gerrit.wikimedia.org/r/117654
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id6ce19608e86b50d1720acb98d010c9b05dcb27e
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Pyfisch <pyfisch(a)gmail.com>
Gerrit-Reviewer: Russell Blau <russblau(a)imapmail.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: remove obsolete pywikibot.stopme() at the end of this script.
......................................................................
remove obsolete pywikibot.stopme() at the end of this script.
In core branch pywikibot.stopme() is called by atexit library.
The function is executed upon normal program termination. This
patch prohibits executing it twice.
Change-Id: I1dcb7930a47c9c58f867c1710d3b4f4600341dd7
---
M scripts/makecat.py
1 file changed, 0 insertions(+), 1 deletion(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/makecat.py b/scripts/makecat.py
index c5869ae..eddde36 100644
--- a/scripts/makecat.py
+++ b/scripts/makecat.py
@@ -296,7 +296,6 @@
loaded -= 1
finally:
- pywikibot.stopme()
try:
excludefile.close()
except:
--
To view, visit https://gerrit.wikimedia.org/r/120205
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1dcb7930a47c9c58f867c1710d3b4f4600341dd7
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: with IDLE sometimes we need maintenance as a library
......................................................................
with IDLE sometimes we need maintenance as a library
Change-Id: I6c51b64e50918b7926ee8bb1a3835fe22144a8a8
---
A scripts/maintenance/__init__.py
1 file changed, 1 insertion(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/maintenance/__init__.py b/scripts/maintenance/__init__.py
new file mode 100644
index 0000000..c47da75
--- /dev/null
+++ b/scripts/maintenance/__init__.py
@@ -0,0 +1 @@
+# THIS DIRECTORY IS TO HOLD BOT SCRIPTS FOR THE NEW FRAMEWORK
--
To view, visit https://gerrit.wikimedia.org/r/120199
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I6c51b64e50918b7926ee8bb1a3835fe22144a8a8
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Don't use SSL if not available
......................................................................
Don't use SSL if not available
There might still be some installations
with httplib without HTTPS for some reason.
Don't try to use https on those (in case
of Wikipedia, the use of SSL was actually
forced).
Change-Id: I5809364eb02d8669fc2b62734ca1e3e48824b129
---
M family.py
1 file changed, 13 insertions(+), 2 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/family.py b/family.py
index 30e2bed..30d2dbc 100644
--- a/family.py
+++ b/family.py
@@ -4209,12 +4209,20 @@
return self.namespace(code, 14, all=True)
# Methods
+ def ssl_available(self):
+ """Check if SSL support is available"""
+ import httplib
+ return hasattr(httplib, "HTTPS")
+
def protocol(self, code):
"""
Can be overridden to return 'https'. Other protocols are not supported.
"""
- return 'http%s' % ('', 's')[config.SSL_connection]
+ if self.ssl_available():
+ return 'http%s' % ('', 's')[config.SSL_connection]
+ else:
+ return 'http'
def hostname(self, code):
"""The hostname to use for standard http connections."""
@@ -4867,4 +4875,7 @@
return ('commons', 'commons')
def protocol(self, code):
- return 'https'
+ if self.ssl_available():
+ return 'https'
+ else:
+ return 'http'
--
To view, visit https://gerrit.wikimedia.org/r/98396
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5809364eb02d8669fc2b62734ca1e3e48824b129
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: saper <saper(a)saper.info>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
Gerrit-Reviewer: saper <saper(a)saper.info>
jenkins-bot has submitted this change and it was merged.
Change subject: does_text_contain_section should match preleading ":" in textlinks
......................................................................
does_text_contain_section should match preleading ":" in textlinks
When a section header contains a text link with preleading colon,
it should match it too:
== [[This is a section header]] ==
== [[:This is also a valid section header]] ==
Additional comments see doc string.
Change-Id: Ie52c3956b4d82bb71c2113cbff476c3dec61fa0c
---
M pywikibot/textlib.py
1 file changed, 20 insertions(+), 3 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 725d676..fdcda92 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -7,7 +7,7 @@
"""
#
-# (C) Pywikibot team, 2008-2013
+# (C) Pywikibot team, 2008-2014
#
# Distributed under the terms of the MIT license.
#
@@ -1104,8 +1104,25 @@
#----------------------------------
def does_text_contain_section(pagetext, section):
- section = re.sub(r'\\[ _]', '[ _]', re.escape(section))
- """Determines whether the page text contains the given section title."""
+ """
+ Determines whether the page text contains the given section title.
+
+ @param pagetext: The wikitext of a page
+ @type text: unicode or string
+ @param section: a section of a page including wikitext markups
+ @type section: unicode or string
+
+ Note: It does not care whether a section string may contain spaces or
+ underlines. Both will match.
+ If a section parameter contains a internal link, it will match the
+ section with or without a preleading colon which is required for a
+ text link e.g. for categories and files.
+
+ """
+ # match preleading colon for text links
+ section = re.sub(r'\\\[\\\[(\\\:)?', '\[\[\:?', re.escape(section))
+ # match underscores and white spaces
+ section = re.sub(r'\\[ _]', '[ _]', section)
m = re.search("=+[ ']*%s[ ']*=+" % section, pagetext)
return bool(m)
--
To view, visit https://gerrit.wikimedia.org/r/114987
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie52c3956b4d82bb71c2113cbff476c3dec61fa0c
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Extended CategoryMoveRobot to remove categories.
......................................................................
Extended CategoryMoveRobot to remove categories.
In the next step the CategoryRemoveRobot will
be merged with the CategoryMoveRobot.
Change-Id: Ib26e7541fd13b06d92261ddbb2b912a854200ab1
---
M scripts/category.py
1 file changed, 44 insertions(+), 25 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/category.py b/scripts/category.py
index f83d9e3..3b174e8 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -389,8 +389,9 @@
class CategoryMoveRobot(object):
- """Bot to move pages from one category to another. The bot
- moves pages and subcategories.
+ """Bot to move pages from one category to another or to remove
+ pages from categories. The bot moves per default pages and
+ subcategories.
"""
@deprecate_arg("oldCatTitle", "oldcat")
@deprecate_arg("newCatTitle", "newcat")
@@ -401,9 +402,9 @@
@deprecate_arg("deleteEmptySourceCat", "delete_oldcat")
@deprecate_arg("titleRegex", "title_regex")
@deprecate_arg("withHistory", "history")
- def __init__(self, oldcat, newcat, batch=False, comment='', inplace=False,
- move_oldcat=True, delete_oldcat=True, title_regex=None,
- history=False):
+ def __init__(self, oldcat, newcat=None, batch=False, comment='',
+ inplace=False, move_oldcat=True, delete_oldcat=True,
+ title_regex=None, history=False, pagesonly=False):
"""Stores all given parameters in the objects attributes.
@param oldcat: The move source.
@@ -420,13 +421,18 @@
matches the regex are moved.
@param history: If True the history of the oldcat is posted on
the talkpage of newcat.
+ @param pagesonly: If True only move pages, not subcategories.
"""
self.site = pywikibot.Site()
# Create attributes for the categories and their talk pages.
self.oldcat = self._makecat(oldcat)
self.oldtalk = self.oldcat.toggleTalkPage()
- self.newcat = self._makecat(newcat)
- self.newtalk = self.newcat.toggleTalkPage()
+ if newcat:
+ self.newcat = self._makecat(newcat)
+ self.newtalk = self.newcat.toggleTalkPage()
+ else:
+ self.newcat = None
+ self.newtalk = None
# Set boolean settings.
self.inplace = inplace
self.move_oldcat = move_oldcat
@@ -434,42 +440,55 @@
self.batch = batch
self.title_regex = title_regex
self.history = history
+ self.pagesonly = pagesonly
# Set edit summary for changed pages.
self.comment = comment
if not self.comment:
- template_vars = {'oldcat': self.oldcat.title(withNamespace=False),
- 'newcat': self.newcat.title(withNamespace=False)}
- self.comment = i18n.twtranslate(self.site,
- 'category-replacing',
- template_vars)
+ if self.newcat:
+ template_vars = { \
+ 'oldcat': self.oldcat.title(
+ withNamespace=False),
+ 'newcat': self.newcat.title(
+ withNamespace=False)}
+ self.comment = i18n.twtranslate(self.site,
+ 'category-replacing',
+ template_vars)
+ else:
+ template_vars = {'oldcat': self.oldcat.title( \
+ withNamespace=False)}
+ self.comment = i18n.twtranslate(self.site,
+ 'category-removing',
+ template_vars)
def run(self):
"""The main bot function that does all the work.
For readability it is splitted into several helper functions.
"""
- if self.move_oldcat and not self.newcat.exists():
+ if self.newcat and self.move_oldcat and not self.newcat.exists():
self._movecat()
self._movetalk()
if self.history:
self._hist()
self._change(pagegenerators.CategorizedPageGenerator(self.oldcat))
- self._change(pagegenerators.SubCategoriesPageGenerator(self.oldcat))
- self._delete()
+ if not pagesonly:
+ self._change(pagegenerators.SubCategoriesPageGenerator( \
+ self.oldcat))
+ if self.oldcat.isEmptyCategory() and self.delete_oldcat and \
+ ((self.newcat and self.move_oldcat) or not self.newcat):
+ self._delete()
def _delete(self):
"""Private function to delete the category page and its talk page.
Do not use this function from outside the class.
"""
- if self.move_oldcat and self.oldcat.isEmptyCategory() and \
- self.delete_oldcat:
- template_vars = {'newcat': self.newcat.title(withNamespace=False),
- 'title': self.newcat.title(withNamespace=False)}
- comment = i18n.twtranslate(self.site,
- 'category-was-moved',
- template_vars)
- self.oldcat.delete(comment, not self.batch, mark=True)
- if self.oldtalk.exists():
- self.oldtalk.delete(comment, not self.batch, mark=True)
+ template_vars = {'newcat': self.newcat.title(withNamespace=False),
+ 'title': self.newcat.title(withNamespace=False)}
+ comment = i18n.twtranslate(self.site,
+ 'category-was-moved',
+ template_vars)
+ self.oldcat.delete(comment, not self.batch, mark=True)
+ if self.oldtalk.exists():
+ self.oldtalk.delete(comment, not self.batch, mark=True)
def _change(self, gen):
"""Private function to move category contents.
--
To view, visit https://gerrit.wikimedia.org/r/110873
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib26e7541fd13b06d92261ddbb2b912a854200ab1
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Pyfisch <pyfisch(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>