http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10573
Revision: 10573
Author: xqt
Date: 2012-10-14 16:18:47 +0000 (Sun, 14 Oct 2012)
Log Message:
-----------
doc type corrected.
Follow-up for r9892.
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2012-10-14 15:07:53 UTC (rev 10572)
+++ trunk/pywikipedia/wikipedia.py 2012-10-14 16:18:47 UTC (rev 10573)
@@ -4987,7 +4987,7 @@
@type fam: str
@param fatal: if True, the bot will stop running if the given family is
unknown. If False, it will only raise a ValueError exception.
- @param fatal: bool
+ @type fatal: bool
@return: a Family instance configured for the named family.
"""
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10571
Revision: 10571
Author: xqt
Date: 2012-10-14 15:03:20 +0000 (Sun, 14 Oct 2012)
Log Message:
-----------
strip trailing whitespace
Modified Paths:
--------------
trunk/pywikipedia/config.py
Modified: trunk/pywikipedia/config.py
===================================================================
--- trunk/pywikipedia/config.py 2012-10-14 13:56:51 UTC (rev 10570)
+++ trunk/pywikipedia/config.py 2012-10-14 15:03:20 UTC (rev 10571)
@@ -103,7 +103,7 @@
# The encoding the user would like to see text transliterated to. This can be
# set to a charset (e.g. 'ascii', 'iso-8859-1' or 'cp850'), and we will output
# only characters that exist in that charset. However, the characters will be
-# output using console_encoding.
+# output using console_encoding.
# If this is not defined on Windows, we emit a Warning explaining the user
# to either switch to a Unicode-able font and use
# transliteration_target = None
@@ -450,12 +450,14 @@
# If you want the bot to also do cosmetic changes when editing a page on a
# foreign wiki, set cosmetic_changes_mylang_only to False, but be careful!
cosmetic_changes_mylang_only = True
+
# The dictionary cosmetic_changes_enable should contain a tuple of languages
# for each site where you wish to enable in addition to your own langlanguage
# (if cosmetic_changes_mylang_only is set)
# Please set your dictionary by adding such lines to your user-config.py:
# cosmetic_changes_enable['wikipedia'] = ('de', 'en', 'fr')
cosmetic_changes_enable = {}
+
# The dictionary cosmetic_changes_disable should contain a tuple of languages
# for each site where you wish to disable cosmetic changes. You may use it with
# cosmetic_changes_mylang_only is False, but you can also disable your own
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10570
Revision: 10570
Author: xqt
Date: 2012-10-14 13:56:51 +0000 (Sun, 14 Oct 2012)
Log Message:
-----------
Large job queue on zh-wiki.
Increase edit delay like on is-wiki for now to prevent further problems;
update from trunk r10569.
Modified Paths:
--------------
branches/rewrite/scripts/interwiki.py
Modified: branches/rewrite/scripts/interwiki.py
===================================================================
--- branches/rewrite/scripts/interwiki.py 2012-10-14 13:53:25 UTC (rev 10569)
+++ branches/rewrite/scripts/interwiki.py 2012-10-14 13:56:51 UTC (rev 10570)
@@ -1654,7 +1654,8 @@
# or the last edit wasn't a bot
# or the last edit was 1 month ago
smallWikiAllowed = True
- if globalvar.autonomous and page.site.sitename() == 'wikipedia:is':
+ if globalvar.autonomous and (page.site.sitename() == 'wikipedia:is' or
+ page.site.sitename() == 'wikipedia:zh'):
old={}
try:
for mypage in new[page.site].interwiki():
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10569
Revision: 10569
Author: xqt
Date: 2012-10-14 13:53:25 +0000 (Sun, 14 Oct 2012)
Log Message:
-----------
Large job queue on zh-wiki.
Increase edit delay like on is-wiki for now to prevent further problems.
Modified Paths:
--------------
trunk/pywikipedia/interwiki.py
Modified: trunk/pywikipedia/interwiki.py
===================================================================
--- trunk/pywikipedia/interwiki.py 2012-10-14 13:42:07 UTC (rev 10568)
+++ trunk/pywikipedia/interwiki.py 2012-10-14 13:53:25 UTC (rev 10569)
@@ -1659,7 +1659,8 @@
# or the last edit wasn't a bot
# or the last edit was 1 month ago
smallWikiAllowed = True
- if globalvar.autonomous and page.site.sitename() == 'wikipedia:is':
+ if globalvar.autonomous and (page.site.sitename() == 'wikipedia:is' or
+ page.site.sitename() == 'wikipedia:zh'):
old={}
try:
for mypage in new[page.site].interwiki():
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10566
Revision: 10566
Author: xqt
Date: 2012-10-14 12:57:06 +0000 (Sun, 14 Oct 2012)
Log Message:
-----------
Bugfix for bug #3546620
* Disambigpages.linkedPages() doesn't raise pywikibot.NoPage error,
so we check it with Page.exists() first.
* lowercase key is needed vor mediawiki_messages since we call it via allmessages query and not the magicwords siteinfo query
* Normalize templates with first letter uppercase
* Add the default template "disambig" for the default (i.e. non-existant) mediawiki message only.
If MediaWiki:Disambiguationspage exist, take the templates without changing its set.
* Site.templates() does not return a list of titles but page links.
Either we have to create a page link while retrieving the template via MediaWiki message
or we use the page.title(withNamespace=False). I took the last one.
TODO: we have to check whether MediaWiki message has the right unicode format to compare with template link titles - sorry for that.
Modified Paths:
--------------
branches/rewrite/pywikibot/page.py
Modified: branches/rewrite/pywikibot/page.py
===================================================================
--- branches/rewrite/pywikibot/page.py 2012-10-14 12:44:14 UTC (rev 10565)
+++ branches/rewrite/pywikibot/page.py 2012-10-14 12:57:06 UTC (rev 10566)
@@ -536,10 +536,10 @@
except KeyError:
distl = None
if distl is None:
- try:
- disambigpages = Page(self.site,
- "MediaWiki:Disambiguationspage")
- disambigs = set(link
+ disambigpages = Page(self.site,
+ "MediaWiki:Disambiguationspage")
+ if disambigpages.exists():
+ disambigs = set(link.title(withNamespace=False)
for link in disambigpages.linkedPages()
if link.namespace() == 10)
# add index article templates
@@ -548,19 +548,24 @@
regex = re.compile('\(\((.+?)\)\)')
content = disambigpages.get()
for index in regex.findall(content):
- disambigs.add(index)
- except pywikibot.NoPage:
- disambigs = set([self.site.mediawiki_message(
- 'Disambiguationspage').split(':', 1)[1]])
- # add the default template(s)
- self.site._disambigtemplates = disambigs | default
+ disambigs.add(index[:1].upper() + index[1:])
+ else:
+ message = self.site.mediawiki_message(
+ 'disambiguationspage').split(':', 1)[1]
+ # add the default template(s) for default mw message
+ # only
+ disambigs = set([message[:1].upper() +
+ message[1:]]) | default
+ self.site._disambigtemplates = disambigs
else:
# Normalize template capitalization
self.site._disambigtemplates = set(
t[:1].upper() + t[1:] for t in distl
)
+ templates = set(tl.title(withNamespace=False)
+ for tl in self.templates())
disambigInPage = self.site._disambigtemplates.intersection(
- self.templates())
+ templates)
self._isDisambig = self.namespace() != 10 and \
len(disambigInPage) > 0
return self._isDisambig