Skip to content

Commit

Permalink
Fixed error about formatting float on a str
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGroundZero committed Nov 5, 2018
1 parent 7117015 commit 35d6738
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions openvasreporting/libs/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,11 @@ def __row_height(text, width):
ws_vuln.set_row(6, __row_height(cves, content_width), None)

ws_vuln.write('B8', "CVSS", format_table_titles)
cvss = vuln.cvss if vuln.cvss != -1.0 else "No CVSS"
ws_vuln.merge_range("C8:G8", "{:.1f}".format(cvss), format_table_cells)
cvss = float(vuln.cvss)
if cvss >= 0.0:
ws_vuln.merge_range("C8:G8", "{:.1f}".format(cvss), format_table_cells)
else:
ws_vuln.merge_range("C8:G8", "{}".format("No CVSS"), format_table_cells)

ws_vuln.write('B9', "Level", format_table_titles)
ws_vuln.merge_range("C9:G9", vuln.level.capitalize(), format_table_cells)
Expand Down

0 comments on commit 35d6738

Please sign in to comment.