russblau(a)svn.wikimedia.org wrote:
Log Message:
-----------
Add redirect templates to category redirect list
This is an example of not reviewed patch.
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2009-01-18 15:06:07 UTC (rev 6265)
+++ trunk/pywikipedia/wikipedia.py 2009-01-18 22:23:28 UTC (rev 6266)
@@ -3415,7 +3415,13 @@
break
groupID = groupMatch.group('name') or
int(groupMatch.group('number'))
replacement = replacement[:groupMatch.start()] +
match.group(groupID) + replacement[groupMatch.end():]
- text = text[:match.start()] + replacement + text[match.end():]
+ try:
+ text = text[:match.start()] + replacement + text[match.end():]
+ except:
+ print text
+ print match.start(), match.end()
+ print replacement
+ raise
Looks as nonsense. Does it be consistency with the rest of the change?
Can this block code raise an exception too?
Modified: trunk/pywikipedia/xmlreader.py
===================================================================
--- trunk/pywikipedia/xmlreader.py 2009-01-18 15:06:07 UTC (rev 6265)
+++ trunk/pywikipedia/xmlreader.py 2009-01-18 22:23:28 UTC (rev 6266)
@@ -160,8 +160,8 @@
# Remove trailing newlines and spaces
while text and text[-1] in '\n ':
text = text[:-1]
- # Replace newline by cr/nl
- text = u'\r\n'.join(text.split('\n'))
+## # Replace newline by cr/nl
+## text = u'\r\n'.join(text.split('\n'))
# Decode the timestamp
timestamp = (self.timestamp[0:4]+
self.timestamp[5:7]+
Maybe have you fixed here a very old problem that I have reported in
mailing-list about unnecessary CR chars in xmlreader module
(
https://lists.wikimedia.org/mailman/htdig/pywikipedia-l/2007-October/000861…
So funny as it is fixed now, but this isn't related to "Add redirect
templates to category redirect list".
--
Francesco Cosoleto