Revision: 4331 Author: russblau Date: 2007-09-19 12:35:52 +0000 (Wed, 19 Sep 2007)
Log Message: ----------- bugfix (article instead of page); break long lines
Modified Paths: -------------- trunk/pywikipedia/catlib.py
Modified: trunk/pywikipedia/catlib.py =================================================================== --- trunk/pywikipedia/catlib.py 2007-09-19 09:02:24 UTC (rev 4330) +++ trunk/pywikipedia/catlib.py 2007-09-19 12:35:52 UTC (rev 4331) @@ -441,10 +441,11 @@ % article.title()) except wikipedia.PageNotSaved, error: wikipedia.output(u"Saving page [[%s]] failed: %s" - % (page.title(), error.message)) + % (article.title(), error.message)) return
- # This loop will replace all occurrences of the category to be changed, and remove duplicates. + # This loop will replace all occurrences of the category to be changed, + # and remove duplicates. newCatList = [] newCatSet = set() for i in range(len(cats)): @@ -455,7 +456,8 @@ sortKey = cat.sortKey if newCat: if newCat.title() not in newCatSet: - newCategory = Category(site, newCat.title(), sortKey = sortKey) + newCategory = Category(site, newCat.title(), + sortKey=sortKey) newCatSet.add(newCat.title()) newCatList.append(newCategory) elif cat.title() not in newCatSet: @@ -468,8 +470,11 @@ text = article.get(nofollow_redirects=True) try: text = wikipedia.replaceCategoryLinks(text, newCatList) - except ValueError: #Make sure that the only way replaceCategoryLinks() can return a ValueError is in the case of interwiki links to self. - wikipedia.output(u'Skipping %s because of interwiki link to self' % (article)) + except ValueError: + # Make sure that the only way replaceCategoryLinks() can return + # a ValueError is in the case of interwiki links to self. + wikipedia.output( + u'Skipping %s because of interwiki link to self' % article) try: article.put(text, comment) except wikipedia.EditConflict:
pywikipedia-l@lists.wikimedia.org