Skip to content

Commit ccf049f

Browse files
excel export: enhance handling of finding groups, better logging (#12435)
* excel export: enhance error logging * excel export: fix foreign key errors
1 parent 741e239 commit ccf049f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

dojo/reports/views.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ def get(self, request):
816816
writer = csv.writer(response)
817817
allowed_attributes = get_attributes()
818818
excludes_list = get_excludes()
819-
allowed_foreign_keys = get_attributes()
819+
allowed_foreign_keys = get_foreign_keys()
820820
first_row = True
821821

822822
for finding in findings:
@@ -940,10 +940,11 @@ def get(self, request):
940940
self.font_bold = font_bold
941941
allowed_attributes = get_attributes()
942942
excludes_list = get_excludes()
943-
allowed_foreign_keys = get_attributes()
943+
allowed_foreign_keys = get_foreign_keys()
944944

945945
row_num = 1
946946
for finding in findings:
947+
logger.debug(f"processing finding: {finding.id}")
947948
if row_num == 1:
948949
col_num = 1
949950
for key in dir(finding):
@@ -955,7 +956,7 @@ def get(self, request):
955956
cell.font = font_bold
956957
col_num += 1
957958
except Exception as exc:
958-
logger.error("Error in attribute: " + str(exc))
959+
logger.warning(f"Error in attribute: {key}" + str(exc))
959960
cell = worksheet.cell(row=row_num, column=col_num, value=key)
960961
col_num += 1
961962
continue
@@ -1007,7 +1008,7 @@ def get(self, request):
10071008
worksheet.cell(row=row_num, column=col_num, value=value)
10081009
col_num += 1
10091010
except Exception as exc:
1010-
logger.error("Error in attribute: " + str(exc))
1011+
logger.warning(f"Error in attribute: {key}" + str(exc))
10111012
worksheet.cell(row=row_num, column=col_num, value="Value not supported")
10121013
col_num += 1
10131014
continue

0 commit comments

Comments
 (0)