Revision: 5711
Author: russblau
Date: 2008-07-13 20:56:14 +0000 (Sun, 13 Jul 2008)
Log Message:
-----------
Change page.isDisambig() method to allow retrieval of disambig template names from the live wiki instead of the Family file, and implement for English Wikipedia; not implemented for all sites by default because users need to decide whether the list on their local [[MediaWiki:Disambiguationspage]] is adequate.
Modified Paths:
--------------
trunk/pywikipedia/families/wikipedia_family.py
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/families/wikipedia_family.py
===================================================================
--- trunk/pywikipedia/families/wikipedia_family.py 2008-07-12 18:18:22 UTC (rev 5710)
+++ trunk/pywikipedia/families/wikipedia_family.py 2008-07-13 20:56:14 UTC (rev 5711)
@@ -513,6 +513,8 @@
}
self.disambiguationTemplates = {
+ # set value to None, instead of a list, to retrieve names from
+ # the live wiki ([[MediaWiki:Disambiguationspage]]
'_default': [u'Disambig'],
'af': [u'Dubbelsinnig', u'Disambig'],
'als': [u'Begriffsklärung', u'Disambig'],
@@ -536,13 +538,7 @@
'da': [u'Flertydig'],
'de': [u'Begriffsklärung', u'BKS', u'Disambig'],
'el': [u'Disambig', u'Αποσαφ', u'Αποσαφήνιση'],
- 'en': [u'Disambig', u'Disambiguation', u'Dab', u'Disamb',
- u'Disambig-cleanup', u'Diasmbig', u'Bio-dab',
- u'Geodis', u'Given name', u'Hndis', u'Hndisambig',
- u'Hndis-cleanup', u'Hospitaldis', u'Letter disambig',
- u'Mathdab', u'NA Broadcast List', u'Numberdis',
- u'POWdis', u'Roadis', u'Roaddis', u'Schooldis',
- u'Shipindex', u'SIA', u'Surname', u'TLA', u'Airport disambig' ],
+ 'en': None,
'eo': [u'Apartigilo', u'Disambig'],
'es': [u'Desambiguacion', u'Desambiguación', u'Desambig', u'Disambig',u'Des'],
'et': [u'Täpsustuslehekülg', u'Täpsustus', u'Disambig'],
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2008-07-12 18:18:22 UTC (rev 5710)
+++ trunk/pywikipedia/wikipedia.py 2008-07-13 20:56:14 UTC (rev 5711)
@@ -983,12 +983,35 @@
def isDisambig(self):
"""Return True if this is a disambiguation page, False otherwise.
- Relies on the presence of specific templates, identified in the Family
- file, to identify disambiguation pages.
+ Relies on the presence of specific templates, identified in
+ the Family file or on a wiki page, to identify disambiguation
+ pages.
+ By default, loads a list of template names from the Family file;
+ if the value in the Family file is None, looks for the list on
+ [[MediaWiki:Disambiguationspage]].
+
"""
- if not hasattr(self, '_isDisambig'):
- foo = self.templates()
+ if not hasattr(self, "_isDisambig"):
+ if not hasattr(self.site(), "_disambigtemplates"):
+ self.site()._disambigtemplates = self.site().family.disambig(self.site().lang)
+ if self.site()._disambigtemplates is None:
+ try:
+ disambigpages = Page(self.site(),
+ "MediaWiki:Disambiguationspage")
+ self.site()._disambigtemplates = [
+ link.titleWithoutNamespace()
+ for link in disambigpages.linkedPages()
+ if link.namespace() == 10
+ ]
+ except NoPage:
+ self.site()._disambigtemplates = ['Disambig']
+ for t in self.templates():
+ if t in self.site()._disambigtemplates:
+ self._isDisambig = True
+ break
+ else:
+ self._isDisambig = False
return self._isDisambig
def getReferences(self,
@@ -1679,7 +1702,12 @@
Template parameters are ignored.
"""
- return [template for (template, param) in self.templatesWithParams(get_redirect=get_redirect)]
+ if not hasattr(self, "_templates"):
+ self._templates = [template
+ for (template, param)
+ in self.templatesWithParams(
+ get_redirect=get_redirect)]
+ return self._templates
def templatesWithParams(self, thistxt=None, get_redirect=False):
"""Return a list of templates used on this Page.
@@ -1690,12 +1718,10 @@
If thistxt is set, it is used instead of current page content.
"""
- check_disambig = (thistxt is None)
if not thistxt:
try:
thistxt = self.get(get_redirect=get_redirect)
except (IsRedirectPage, NoPage):
- self._isDisambig = False
return []
# remove commented-out stuff etc.
@@ -1746,9 +1772,6 @@
u"Page %s contains invalid template name {{%s}}."
% (self.title(), name.strip()))
continue
- if check_disambig and \
- name in self.site().family.disambig(self.site().lang):
- self._isDisambig = True
# Parameters
paramString = m.group('params')
params = []
@@ -1776,8 +1799,6 @@
# Add it to the result
result.append((name, params))
- if check_disambig and not hasattr(self, "_isDisambig"):
- self._isDisambig = False
return result
def getRedirectTarget(self):
Bugs item #2003306, was opened at 2008-06-26 17:31
Message generated for change (Comment added) made by sf-robot
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2003306&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
Resolution: Invalid
Priority: 5
Private: No
Submitted By: Carsrac (carsrac)
Assigned to: Nobody/Anonymous (nobody)
Summary: local wo word for portal
Initial Comment:
WARNING: [[wo:Bunt:Melosuuf]] is in namespace 0, but [[ro:Portal:Geografie]] is in namespace 100.
The interwiki bot does not reconize the local word for namespace 100.
Bunt is the local wo word for Portal or namespace 100.
----------------------------------------------------------------------
>Comment By: SourceForge Robot (sf-robot)
Date: 2008-07-13 02:20
Message:
Logged In: YES
user_id=1312539
Originator: NO
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
----------------------------------------------------------------------
Comment By: Andre Engels (a_engels)
Date: 2008-06-28 09:08
Message:
Logged In: YES
user_id=843018
Originator: NO
It's not recognized as a namespace by the MediaWiki software.
----------------------------------------------------------------------
Comment By: Andre Engels (a_engels)
Date: 2008-06-28 09:07
Message:
Logged In: YES
user_id=843018
Originator: NO
It's not recognized as a namespace by the MediaWiki software.
----------------------------------------------------------------------
Comment By: Andre Engels (a_engels)
Date: 2008-06-28 09:06
Message:
Logged In: YES
user_id=843018
Originator: NO
It's not recognized as a namespace by the MediaWiki software.
----------------------------------------------------------------------
Comment By: Andre Engels (a_engels)
Date: 2008-06-28 09:06
Message:
Logged In: YES
user_id=843018
Originator: NO
It's not recognized as a namespace by the MediaWiki software.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2003306&group_…
Bugs item #1870323, was opened at 2008-01-13 08:17
Message generated for change (Settings changed) made by russblau
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1870323&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: interwiki
Group: None
>Status: Closed
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: Alex S.H. Lin (lin4h)
Assigned to: Nobody/Anonymous (nobody)
Summary: interwiki.py remove the category link in zhwiki
Initial Comment:
from this revision.
http://zh.wikipedia.org/w/index.php?title=Hunter_%C3%97_Hunter&diff=6015464…
The console commsnd is :
interwiki.py -lang:ja Hunter_%C3%97_Hunter
(check interwiki from jawiki,bu I have no idea why it remove the category link automatically )
----------------------------------------------------------------------
Comment By: Rotem Liss (rotemliss)
Date: 2008-01-13 13:48
Message:
Logged In: YES
user_id=1327030
Originator: NO
I guess you have cosmetic changes enabled and your default language is zh
(or you enable cosmetic changes for all languages). If so, this is the same
as bug 1863432 and was fixed in r4874. Make sure you check all your bot's
previous changes that did cosmetic changes.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1870323&group_…
Bugs item #1730220, was opened at 2007-06-03 09:26
Message generated for change (Settings changed) made by russblau
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1730220&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: interwiki
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Purodha B Blissenbach (purodha)
Assigned to: Nobody/Anonymous (nobody)
Summary: interwiki.py -untranslatedonly -number:nn not intuitive
Initial Comment:
interwiki.py -untranslatedonly -number:nn -confirm
acts counterinuitively. I expect the be asked for nn groups of page hints, and that nn pages may be altered.
In fact, nn pages are being checked, and only those among them which match the -untranslatedonly criterion, are possibly altered. Only for those, hints are being asked from me. Their number is usually far less than nn, and may be even zero. I have to know, or guess, how many "-untranslatedonly" pages there are in a selection, given e.g. by -cat:cc, or -link:ll, etc., and how these are distributed, so as to find a decent value for nn, to avoid unneccessary loading of pages (if I choose nn too high) or a too short session (if I choose nn too low) which due to reprocessing the same call with a larger nn, again creates an unneccessary burden on the servers.
What I want with -untranslatedonly -number:nn -confirm, is to process exactly nn pages. I want to be asked about less pages only, if my selection has been exhausted before nn pages have been processed.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1730220&group_…
Bugs item #1641431, was opened at 2007-01-22 04:54
Message generated for change (Comment added) made by russblau
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1641431&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: interwiki
Group: None
>Status: Pending
Resolution: None
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: crash on warnfile.py
Initial Comment:
splitwarning.py
<all generated ok>
warnfile.py -lang:ca
Checked for running processes. 1 processes currently running, including the curr
ent process.
Parsing warnfile...
Fixing... 22 pages
Getting page [[Categoria:1250]]
Traceback (most recent call last):
File "warnfile.py", line 121, in
?
main()
File "warnfile.py", line 117, in
main
bot.run()
File "warnfile.py", line 94, in
run
mods, removing = interwiki.compareLanguages(old, new, insite = page.site())
ValueError: too many values to unpack
----------------------------------------------------------------------
>Comment By: Russell Blau (russblau)
Date: 2008-07-11 17:05
Message:
Logged In: YES
user_id=855050
Originator: NO
Does this report still need attention? Please update or the bug will be
closed automatically after 30 days.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1641431&group_…