Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions cloudwash/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import dateparser
import dominate
import pytz
from dominate.tags import br
from dominate.tags import caption
from dominate.tags import div
from dominate.tags import h1
Expand Down Expand Up @@ -155,22 +154,32 @@ def create_html(provider, all_data):
td(table_head.replace("_", " ").title())
bullet = '•'
tab = ' '
line_break = '<br>'
if isinstance(data[table_head], list):
component = ''
for resource_name in data[table_head]:
component += bullet + ' ' + resource_name + ' '
td(raw(component))
if component:
td(raw(component))
elif isinstance(data[table_head], dict):
component = []
for rtype, resources in data[table_head].items():
comp_line = ' ' + tab * 2 + ' '
rtype_line = bullet + rtype + str(br())
for resource_name in resources:
comp_line += bullet + ' ' + resource_name + ' '
component.append(rtype_line + comp_line)
td(raw(str(br()).join(component)))
rtype_line = bullet + rtype + line_break
if len(resources):
component.append(rtype_line)
comp_line = tab * 2 + ' '
for resource_name in resources:
comp_line += (
bullet + ' ' + resource_name + ' '
)
comp_line += line_break
component.append(comp_line)
joined_component = ' '.join(component)
if joined_component:
td(raw(joined_component))
else:
td(raw(bullet + ' ' + data[table_head]))
header = bullet + ' ' + data[table_head]
td(raw(header))
with open(f'cleanup_resource_{provider}.html', 'w') as file:
file.write(doc.render())

Expand Down