Skip to content

Commit

Permalink
remove unnecessary assert error
Browse files Browse the repository at this point in the history
Signed-off-by: Dennis Wambua <[email protected]>
  • Loading branch information
denniswambua committed Jan 27, 2017
1 parent 9785e52 commit 9f56d83
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions onadata/libs/utils/csv_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,18 +340,13 @@ def _reindex(cls, key, value, ordered_columns, row, data_dictionary,
"""
def get_ordered_repeat_value(xpath, repeat_value):
children = data_dictionary.get_child_elements(xpath)
count_keys = len(repeat_value.keys())
item = OrderedDict()

for elem in children:
xp = elem.get_abbreviated_xpath()
if xp in repeat_value:
item[xp] = repeat_value[xp]

count_ordered = len(item.keys())
assert count_keys == count_ordered, \
"Only %s of %s were found" % (count_ordered, count_keys)

return item

d = {}
Expand All @@ -366,10 +361,7 @@ def get_ordered_repeat_value(xpath, repeat_value):
# this dict
if type(item) is dict:
# order repeat according to xform order
try:
item = get_ordered_repeat_value(key, item)
except AssertionError:
pass
item = get_ordered_repeat_value(key, item)

for nested_key, nested_val in item.iteritems():
# given the key "children/details" and nested_key/
Expand Down

0 comments on commit 9f56d83

Please sign in to comment.