r85603 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85602‎ | r85603 | r85604 >
Date:01:43, 7 April 2011
Author:diederik
Status:deferred
Tags:
Comment:
Additional debug messages
Modified paths:
  • /trunk/tools/editor_trends/etl/enricher.py (modified) (history)

Diff [purge]

Index: trunk/tools/editor_trends/etl/enricher.py
@@ -524,7 +524,7 @@
525525 print xml_namespace
526526 elements = siteinfo.find('%s%s' % (xml_namespace, 'namespaces'))
527527 print elements
528 - for elem in elements:
 528+ for elem in elements.getchildren():
529529 key = int(elem.get('key'))
530530 namespaces[key] = elem.text #extract_text(ns)
531531 text = elem.text if elem.text != None else ''
@@ -532,6 +532,8 @@
533533 print key, text.encode('utf-8')
534534 except UnicodeEncodeError:
535535 print key
 536+ elem.clear()
 537+ siteinfo.clear()
536538 if namespaces == {}:
537539 sys.exit(-1)
538540 return namespaces
@@ -546,7 +548,10 @@
547549 xml_namespace = elem.tag
548550 pos = xml_namespace.find('sitename')
549551 xml_namespace = xml_namespace[0:pos]
 552+ elem.clear()
550553 return xml_namespace
 554+ else:
 555+ elem.clear()
551556
552557
553558 def count_edits(article, counts, bots, xml_namespace):
@@ -659,8 +664,8 @@
660665 article['revisions'] = []
661666 article['namespaces'] = namespaces
662667 id = False
663 - elif rts.kaggle == True and event == 'end':
664 - elem.clear()
 668+ #elif rts.kaggle == True and event == 'end':
 669+ # elem.clear()
665670 except SyntaxError, error:
666671 print 'Encountered invalid XML tag. Error message: %s' % error
667672 dump(elem)