r85696 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85695‎ | r85696 | r85697 >
Date:21:46, 8 April 2011
Author:diederik
Status:deferred
Tags:
Comment:
Modified paths:
  • /trunk/tools/editor_trends/etl/enricher.py (modified) (history)

Diff [purge]

Index: trunk/tools/editor_trends/etl/enricher.py
@@ -151,7 +151,7 @@
152152 editors = {}
153153 #first, we group all revisions by editor
154154
155 - for revision in self.revisions:
 155+ for revision in self.revisions.values():
156156 row = []
157157 #strip away the keys and make sure that the values are always in the same sequence
158158 for key in self.keys:
@@ -164,7 +164,7 @@
165165 #now, we are going to group all editors by file_id
166166 file_ids = self.invert_dictionary(editors)
167167 self.revisions = {}
168 - for file_id, editors in file_ids:
 168+ for file_id, editors in file_ids.iteritems():
169169 for editor in editors:
170170 self.revisions.setdefault(file_id, [])
171171 self.revisions[file_id].extend(data[editor])
@@ -254,11 +254,11 @@
255255 break
256256 try:
257257 file_utils.write_list_to_csv(revision, fh)
258 - self.lock.release(file_id)
259 - del self.revisions[file_id]
260258 except Exception, error:
261259 print '''Encountered the following error while writing
262260 revision data to %s: %s''' % (fh, error)
 261+ self.lock.release(file_id)
 262+ del self.revisions[file_id]
263263 #t1 = datetime.datetime.now()
264264 #print '%s revisions took %s' % (len(self.revisions), (t1 - t0))
265265