utils: handle proxy objects in ods export (#38641)

This commit is contained in:
Serghei Mihai 2019-12-19 14:04:40 +01:00
parent 980cb76aae
commit a5b82bf9f6
2 changed files with 3 additions and 2 deletions

View File

@ -323,7 +323,7 @@ class Visualization(object):
if self.measure.type == 'integer':
try:
value = int(value)
except ValueError:
except (ValueError, TypeError):
pass
sheet.write(j + 1, i, 0 if value is None else value)
return workbook

View File

@ -133,6 +133,7 @@ def test_ods(schema1, app, admin):
form.set('representation', 'table')
form.set('measure', 'simple_count')
form.set('drilldown_x', 'innersubcategory')
form.set('drilldown_y', 'hour')
response = form.submit('visualize')
assert 'big-msg-info' not in response
response = response.click(href='save')
@ -144,7 +145,7 @@ def test_ods(schema1, app, admin):
assert get_table(response) == get_ods_table(ods_response)[1:]
root = get_ods_document(ods_response)
nodes = root.findall('.//{%s}table-cell' % TABLE_NS)
assert len([node for node in nodes if node.attrib['{%s}value-type' % OFFICE_NS] == 'float']) == 2
assert len([node for node in nodes if node.attrib['{%s}value-type' % OFFICE_NS] == 'float']) == 4
app.reset() # logout
assert 'login' in app.get(ods_response.request.url, status=302).location