r84873 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84872‎ | r84873 | r84874 >
Date:18:53, 27 March 2011
Author:diederik
Status:deferred
Tags:
Comment:
Added namespace support when parsing xml.
Modified paths:
  • /trunk/tools/editor_trends/etl/enricher.py (modified) (history)

Diff [purge]

Index: trunk/tools/editor_trends/etl/enricher.py
@@ -348,7 +348,7 @@
349349 def count_edits(article, counts, bots):
350350 title = article['title'].text
351351 namespace = determine_namespace(title)
352 -
 352+ xml_namespace = 'http://www.mediawiki.org/xml/export-0.4/'
353353 if namespace != False:
354354 article_id = article['id'].text
355355 revisions = article['revisions']
@@ -357,7 +357,7 @@
358358 #the entire revision is empty, weird.
359359 continue
360360 dump(revision)
361 - contributor = revision.find('ns0:contributor')
 361+ contributor = revision.find('%s:contributor' % xml_namespace)
362362 contributor = parse_contributor(contributor, bots)
363363 if not contributor:
364364 #editor is anonymous, ignore