Commit 7440f417 authored by Romain Courteaud's avatar Romain Courteaud

slapos_upgrader: print

parent ce879ddf
# https://playground.diagram.codes/d/graph
print "ARROWS"
print ""
print("ARROWS")
print("")
project_dict = {}
remote_project_dict = {}
......@@ -46,8 +46,8 @@ for project_uid, project_value_dict in project_dict.items():
display_dict[remote_key]['title'] = '%s\n%s' % (display_dict[remote_key]['title'], project_value_dict['title'])
for display_key, display_value in display_dict.items():
print '"%s" as %s' % (display_value['title'], display_key)
print ''
print('"%s" as %s' % (display_value['title'], display_key))
print('')
for display_key, display_value in display_dict.items():
has_remote = False
......@@ -55,10 +55,10 @@ for display_key, display_value in display_dict.items():
if remote_uid in display_dict:
# only not destroyed links
has_remote = True
print '%s->%s' % (display_key, remote_uid)
print('%s->%s' % (display_key, remote_uid))
if (not has_remote) and (display_key not in remote_project_dict):
print '%s->%s' % (display_key, display_key)
print ''
print('%s->%s' % (display_key, display_key))
print('')
return printed
......@@ -27,7 +27,7 @@ for sql_result in sql_result_list:
soft_proj_dict[soft]['project_list'].append(project)
soft_proj_dict[soft]['count'] = soft_proj_dict[soft]['count'] + int(sql_result['count(*)'])
print '<ul>'
print('<ul>')
"""
for project, soft_dict in project_soft_dict.items():
print '<li><p>%s</p><ul>' % project
......@@ -38,13 +38,13 @@ for project, soft_dict in project_soft_dict.items():
ordered_list = soft_proj_dict.items()
ordered_list.sort()
for soft, info_dict in ordered_list:
print '<li><p>%s <b>%i</b> %s</p>' % (soft, info_dict['count'], str(list(set(info_dict['project_list']))))
print('<li><p>%s <b>%i</b> %s</p>' % (soft, info_dict['count'], str(list(set(info_dict['project_list'])))))
"""
for proj in list(set(info_dict['project_list'])):
print '<li><p>%s</p></li>' % (proj)
"""
print '</li>'
print '</ul>'
print('</li>')
print('</ul>')
context.REQUEST.RESPONSE.setHeader('Content-Type', 'text/html')
return printed
......@@ -25,8 +25,8 @@ for sql_result in portal.portal_catalog(title='slapmigration',
instance_tree_dict[instance_tree.getRelativeUrl()] = instance_tree
print '<h1>Broken instances (allocated on multiple virtual master)</h1>'
print '<ol>'
print('<h1>Broken instances (allocated on multiple virtual master)</h1>')
print('<ol>')
print_info_list = []
for instance_tree_relative_url, instance_tree in instance_tree_dict.items():
......@@ -55,11 +55,11 @@ for instance_tree_relative_url, instance_tree in instance_tree_dict.items():
sorted(print_info_list, key=lambda print_info: print_info[0])
print_info_list.sort()
for print_info in print_info_list:
print '<li><p><b>%s</b> <a href="%s">%s</a> (%s) </p><ul>' % print_info[:-1]
print('<li><p><b>%s</b> <a href="%s">%s</a> (%s) </p><ul>' % print_info[:-1])
for instance_info in print_info[-1]:
print '<li><i>%s</i> <a href="%s">%s</a></li>' % instance_info
print '</ul></li>'
print '</ol>'
print('<li><i>%s</i> <a href="%s">%s</a></li>' % instance_info)
print('</ul></li>')
print('</ol>')
context.REQUEST.RESPONSE.setHeader('Content-Type', 'text/html')
return printed
......@@ -22,8 +22,8 @@ for sql_result in portal.portal_catalog(source_section__uid='%',
missing_price_project_dict[software_product.getFollowUp()].append(software_product)
print '<h1>Missing price</h1>'
print '<ol>'
print('<h1>Missing price</h1>')
print('<ol>')
print_info_list = []
for _, software_product_list in missing_price_project_dict.items():
......@@ -31,11 +31,11 @@ for _, software_product_list in missing_price_project_dict.items():
print_info_list.sort()
for print_info in print_info_list:
print '<li><p><b>%s</b></p><ul>' % print_info[0]
print('<li><p><b>%s</b></p><ul>' % print_info[0])
for software_product in print_info[1]:
print '<li><i><a href="%s">%s</a></i></li>' % (software_product.getRelativeUrl(), software_product.getTitle())
print '</ul></li>'
print '</ol>'
print('<li><i><a href="%s">%s</a></i></li>' % (software_product.getRelativeUrl(), software_product.getTitle()))
print('</ul></li>')
print('</ol>')
#############################################
# Item without Subscription Request
......@@ -59,8 +59,8 @@ for sql_result in portal.portal_catalog(
orphaned_item_project_dict[item.getFollowUp()] = []
orphaned_item_project_dict[item.getFollowUp()].append(item)
print '<h1>Subscription not created</h1>'
print '<ol>'
print('<h1>Subscription not created</h1>')
print('<ol>')
print_info_list = []
for _, item_list in orphaned_item_project_dict.items():
......@@ -68,16 +68,16 @@ for _, item_list in orphaned_item_project_dict.items():
print_info_list.sort()
for print_info in print_info_list:
print '<li><p><b>%s</b></p><ul>' % print_info[0]
print('<li><p><b>%s</b></p><ul>' % print_info[0])
for item in print_info[1]:
product_dict = item.InstanceTree_getSoftwareProduct()
if product_dict[0] is not None:
product_title = product_dict[0].getTitle()
else:
product_title = ""
print '<li><i><a href="%s">%s</a></i> (%s)</li>' % (item.getRelativeUrl(), item.getTitle(), product_title)
print '</ul></li>'
print '</ol>'
print('<li><i><a href="%s">%s</a></i> (%s)</li>' % (item.getRelativeUrl(), item.getTitle(), product_title))
print('</ul></li>')
print('</ol>')
context.REQUEST.RESPONSE.setHeader('Content-Type', 'text/html')
return printed
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment