Patches item #1857406, was opened at 2007-12-24 14:26
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1857406&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: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Alex S.H. Lin (lin4h)
Assigned to: Nobody/Anonymous (nobody)
Summary: update zh, ja messages
Initial Comment:
as title
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1857406&group_…
Patches item #1857276, was opened at 2007-12-23 17:19
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1857276&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: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: ko support for featured.py
Initial Comment:
Please apply attached patch to featured.py.
comments/featured article support for ko - Korean. Thanks.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1857276&group_…
Revision: 4753
Author: rotem
Date: 2007-12-22 14:45:38 +0000 (Sat, 22 Dec 2007)
Log Message:
-----------
Update URL.
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2007-12-22 14:00:39 UTC (rev 4752)
+++ trunk/pywikipedia/wikipedia.py 2007-12-22 14:45:38 UTC (rev 4753)
@@ -3158,7 +3158,7 @@
if site is None:
site = getSite()
if site.sitename() == 'wikipedia:de':
- raise Error('The PyWikipediaBot is no longer allowed to touch categories on the German Wikipedia. See http://de.wikipedia.org/wiki/Hilfe_Diskussion:Personendaten/Archiv2#Positio…')
+ raise Error('The PyWikipediaBot is no longer allowed to touch categories on the German Wikipedia. See http://de.wikipedia.org/wiki/Hilfe_Diskussion:Personendaten/Archiv/bis_2006…')
s = categoryFormat(new, insite = site)
s2 = removeCategoryLinks(oldtext, site = site, marker = marker)
Revision: 4752
Author: filnik
Date: 2007-12-22 14:00:39 +0000 (Sat, 22 Dec 2007)
Log Message:
-----------
Adding a more powerful checkmethod for the 'white-templates' to skip.
Modified Paths:
--------------
trunk/pywikipedia/checkimages.py
Modified: trunk/pywikipedia/checkimages.py
===================================================================
--- trunk/pywikipedia/checkimages.py 2007-12-22 13:35:46 UTC (rev 4751)
+++ trunk/pywikipedia/checkimages.py 2007-12-22 14:00:39 UTC (rev 4752)
@@ -221,11 +221,14 @@
# If a template isn't a license but it's included on a lot of images, that can be skipped to
# analise the image without taking care of it. (the template must be in a list)
+# Warning: Don't add template like "en, de, it" because they are already in (added in the code, below
+# Warning 2: The bot will use regex, make the names compatible, please (don't add "Template:" or {{
+# because they are already put in the regex).
HiddenTemplate = {
- 'commons':['{{information'],
- 'en':['{{information'],
- 'it':['{{edp', '{{informazioni file', '{{information'],
- 'hu':[u'{{információ','{{enwiki', '{{azonnali'],
+ 'commons':['information'],
+ 'en':['information'],
+ 'it':['edp', 'informazioni[ _]file', 'information'],
+ 'hu':[u'információ','enwiki', 'azonnali'],
}
# Add your project (in alphabetical order) if you want that the bot start
@@ -233,7 +236,7 @@
# Ok, that's all. What is below, is the rest of code, now the code is fixed and it will run correctly in your project.
#########################################################################################################################
-# <------------------------------------------- Change only above! ----------------------------------------------------->#
+# <------------------------------------------- Change only above! ----------------------------------------------------> #
#########################################################################################################################
class LogIsFull(wikipedia.Error):
@@ -648,7 +651,7 @@
# In this way i find what language, project and what bot do you use.
lang = config.mylang
project = config.family
-
+
# Block of text to translate the parameters set above.
image_n = site.image_namespace()
image_namespace = "%s:" % image_n
@@ -671,6 +674,9 @@
com = wikipedia.translate(site, comm10)
TextFind = wikipedia.translate(site, txt_find)
hiddentemplate = wikipedia.translate(site, HiddenTemplate)
+ # A template as {{en is not a license! Adding also them in the whitelist template...
+ for langK in wikipedia.Family('wikipedia').knownlanguages:
+ hiddentemplate.append('%s' % langK)
if skip_number == 0:
skip = False
@@ -775,12 +781,13 @@
wikipedia.output(u"The file description for %s is a redirect?!" % imageName )
continue
for l in hiddentemplate:
- if l.lower() in g.lower():
+ res = re.findall(r'\{\{(?:[Tt]emplate:|)%s(?: |\||\n|\W)' % l.lower(), g.lower())
+ if res != []:
+ #print res
wikipedia.output(u'A white template found, skipping the template...')
- #whiteTemplate = True
- #final_text = g
+ # I don't delete the template, because if there is something to change the image page
+ # will be reloaded. I delete it only for the next check part.
g = g.lower().replace(l, '')
- #print g
for a_word in something:
if a_word in g:
parentesi = True
Revision: 4750
Author: rotem
Date: 2007-12-22 13:31:02 +0000 (Sat, 22 Dec 2007)
Log Message:
-----------
Fixing comments.
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2007-12-22 13:28:10 UTC (rev 4749)
+++ trunk/pywikipedia/wikipedia.py 2007-12-22 13:31:02 UTC (rev 4750)
@@ -2923,7 +2923,7 @@
Return a dict of interlanguage links found in text.
Dict uses language codes as keys and Page objects as values.
- Do not call this routine directly, use Page.interwikiLinks() method
+ Do not call this routine directly, use Page.interwiki() method
instead.
"""
@@ -2970,7 +2970,7 @@
If a link to an unknown language is encountered, a warning is printed.
If a marker is defined, that string is placed at the location of the
last occurence of an interwiki link (at the end if there are no
- interwikilinks).
+ interwiki links).
"""
if site == None:
Revision: 4749
Author: rotem
Date: 2007-12-22 13:28:10 +0000 (Sat, 22 Dec 2007)
Log Message:
-----------
Not getting supercategories from the category page - not needed; getting them in the usual way for pages.
Modified Paths:
--------------
trunk/pywikipedia/catlib.py
Modified: trunk/pywikipedia/catlib.py
===================================================================
--- trunk/pywikipedia/catlib.py 2007-12-22 13:06:46 UTC (rev 4748)
+++ trunk/pywikipedia/catlib.py 2007-12-22 13:28:10 UTC (rev 4749)
@@ -39,7 +39,6 @@
# some constants that are used internally
ARTICLE = 0
SUBCATEGORY = 1
-SUPERCATEGORY = 2
def isCatTitle(title, site):
return ':' in title and title[:title.index(':')] in site.category_namespaces()
@@ -64,7 +63,6 @@
self.completelyCached = False
self.articleCache = []
self.subcatCache = []
- self.supercatCache = []
def aslink(self, forceInterwiki = False):
"""
@@ -83,8 +81,7 @@
else:
return '[[%s]]' % titleWithSortKey
- def _getContentsAndSupercats(self, recurse=False, purge=False,
- startFrom=None, cache=None):
+ def _getContents(self, recurse=False, purge=False, startFrom=None, cache=None):
"""
Cache results of _parseCategory for a second call.
@@ -120,12 +117,8 @@
# contents of subcategory are cached by calling
# this method recursively; therefore, do not cache
# them again
- for item in subcat._getContentsAndSupercats(newrecurse,
- purge, cache=cache):
- if item[0] != SUPERCATEGORY:
- yield item
- for supercat in self.supercatCache:
- yield SUPERCATEGORY, supercat
+ for item in subcat._getContents(newrecurse, purge, cache=cache):
+ yield item
else:
for tag, page in self._parseCategory(purge, startFrom):
if tag == ARTICLE:
@@ -142,28 +135,22 @@
# contents of subcategory are cached by calling
# this method recursively; therefore, do not cache
# them again
- for item in page._getContentsAndSupercats(
- newrecurse, purge, cache=cache):
- if item[0] != SUPERCATEGORY:
- yield item
- elif tag == SUPERCATEGORY:
- self.supercatCache.append(page)
- yield SUPERCATEGORY, page
+ for item in page._getContents(newrecurse, purge, cache=cache):
+ yield item
if not startFrom:
self.completelyCached = True
def _parseCategory(self, purge=False, startFrom=None):
"""
- Yields all articles and subcategories that are in this category,
- as well as its supercategories.
+ Yields all articles and subcategories that are in this category.
Set purge to True to instruct MediaWiki not to serve a cached version.
Set startFrom to a string which is the title of the page to start from.
Yielded results are tuples in the form (tag, page) where tag is one
- of the constants ARTICLE, SUBCATEGORY and SUPERCATEGORY, and title is
- the Page or Category object.
+ of the constants ARTICLE and SUBCATEGORY, and title is the Page or Category
+ object.
Note that results of this method need not be unique.
@@ -201,8 +188,6 @@
wikipedia.output('Getting [[%s]]...' % self.title())
wikipedia.get_throttle()
txt = self.site().getUrl(path)
- # save a copy of this text to find out self's supercategory.
- self_txt = txt
# index where subcategory listing begins
try:
ibegin = txt.index('<div id="mw-subcategories">')
@@ -264,25 +249,6 @@
break
else:
break
-
- # get supercategories
- try:
- ibegin = self_txt.index('<div id="catlinks">')
- iend = self_txt.index('<!-- end content -->')
- except ValueError:
- # no supercategories found
- pass
- else:
- self_txt = self_txt[ibegin:iend]
- if self.site().versionnumber() < 5:
- # MediaWiki 1.4 has an unneeded space here
- Rsupercat = re.compile('title ="([^"]*)"')
- else:
- Rsupercat = re.compile('title="([^"]*)"')
- for title in Rsupercat.findall(self_txt):
- # There might be a link to Special:Categories we don't want
- if isCatTitle(title, self.site()):
- yield SUPERCATEGORY, title
def subcategories(self, recurse=False):
"""
@@ -296,7 +262,7 @@
Results a sorted (as sorted by MediaWiki), but need not be unique.
"""
- for tag, subcat in self._getContentsAndSupercats(recurse):
+ for tag, subcat in self._getContents(recurse):
if tag == SUBCATEGORY:
yield subcat
@@ -325,7 +291,7 @@
Results are unsorted (except as sorted by MediaWiki), and need not
be unique.
"""
- for tag, page in self._getContentsAndSupercats(recurse, startFrom=startFrom):
+ for tag, page in self._getContents(recurse, startFrom=startFrom):
if tag == ARTICLE:
yield page
@@ -351,9 +317,8 @@
Results are stored in the order in which they were entered, and need
not be unique.
"""
- for tag, supercat in self._getContentsAndSupercats():
- if tag == SUPERCATEGORY:
- yield supercat
+ for supercat in self.categories():
+ yield supercat
def supercategoriesList(self):
"""
@@ -368,7 +333,7 @@
def isEmpty(self):
# TODO: rename; naming conflict with Page.isEmpty
- for tag, title in self._getContentsAndSupercats(purge = True):
+ for tag, title in self._getContents(purge = True):
if tag in (ARTICLE, SUBCATEGORY):
return False
return True