Index: trunk/tools/editor_trends/etl/enricher.py |
— | — | @@ -151,7 +151,7 @@ |
152 | 152 | editors = {} |
153 | 153 | #first, we group all revisions by editor |
154 | 154 | |
155 | | - for revision in self.revisions: |
| 155 | + for revision in self.revisions.values(): |
156 | 156 | row = [] |
157 | 157 | #strip away the keys and make sure that the values are always in the same sequence |
158 | 158 | for key in self.keys: |
— | — | @@ -164,7 +164,7 @@ |
165 | 165 | #now, we are going to group all editors by file_id |
166 | 166 | file_ids = self.invert_dictionary(editors) |
167 | 167 | self.revisions = {} |
168 | | - for file_id, editors in file_ids: |
| 168 | + for file_id, editors in file_ids.iteritems(): |
169 | 169 | for editor in editors: |
170 | 170 | self.revisions.setdefault(file_id, []) |
171 | 171 | self.revisions[file_id].extend(data[editor]) |
— | — | @@ -254,11 +254,11 @@ |
255 | 255 | break |
256 | 256 | try: |
257 | 257 | file_utils.write_list_to_csv(revision, fh) |
258 | | - self.lock.release(file_id) |
259 | | - del self.revisions[file_id] |
260 | 258 | except Exception, error: |
261 | 259 | print '''Encountered the following error while writing |
262 | 260 | revision data to %s: %s''' % (fh, error) |
| 261 | + self.lock.release(file_id) |
| 262 | + del self.revisions[file_id] |
263 | 263 | #t1 = datetime.datetime.now() |
264 | 264 | #print '%s revisions took %s' % (len(self.revisions), (t1 - t0)) |
265 | 265 | |