r81310 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81309‎ | r81310 | r81311 >
Date:17:41, 1 February 2011
Author:diederik
Status:deferred
Tags:
Comment:
Handle dictionaries as data in writing to csv.
Modified paths:
  • /trunk/tools/editor_trends/utils/data_converter.py (modified) (history)

Diff [purge]

Index: trunk/tools/editor_trends/utils/data_converter.py
@@ -54,7 +54,12 @@
5555
5656 for obs in var['obs'][date]['data']:
5757 if ds.format == 'long':
58 - o.append([datum, obs, var['obs'][date]['data'][obs]])
 58+ if isinstance(var['obs'][date]['data'], dict):
 59+ for subdata in var['obs'][date]['data']:
 60+ for k,v in var['obs'][date]['data'][subdata]['data'].iteritems():
 61+ o.append([datum, obs, k, v])
 62+ else:
 63+ o.append([datum, obs, var['obs'][date]['data'][obs]])
5964 data.extend(o)
6065 o = []
6166 else:

Status & tagging log