diff options
Diffstat (limited to 'scripts/minimaws/lib/wsgiserve.py')
-rw-r--r-- | scripts/minimaws/lib/wsgiserve.py | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/scripts/minimaws/lib/wsgiserve.py b/scripts/minimaws/lib/wsgiserve.py index 3b92f08110d..1158528d954 100644 --- a/scripts/minimaws/lib/wsgiserve.py +++ b/scripts/minimaws/lib/wsgiserve.py @@ -661,6 +661,20 @@ class SoftwareListHandler(QueryPageHandler): unsupported=htmlescape('%d' % (softwarelist_info['unsupported'], )), unsupportedpc=htmlescape('%.1f' % (softwarelist_info['unsupported'] * 100.0 / (softwarelist_info['total'] or 1), ))).encode('utf-8') + if softwarelist_info['notes'] is not None: + yield htmltmpl.SOFTWARELIST_NOTES_PROLOGUE.substitute().encode('utf-8') + first = True + for line in softwarelist_info['notes'].strip().splitlines(): + if line: + yield (('<p>%s' if first else '<br />\n%s') % (htmlescape(line), )).encode('utf-8') + first = False + elif not first: + yield '</p>\n'.encode('utf-8') + first = True + if not first: + yield '</p>\n'.encode('utf-8') + yield htmltmpl.SOFTWARELIST_NOTES_EPILOGUE.substitute().encode('utf-8') + first = True for machine_info in self.dbcurs.get_softwarelist_machines(softwarelist_info['id']): if first: @@ -689,9 +703,6 @@ class SoftwareListHandler(QueryPageHandler): yield htmltmpl.SORTABLE_TABLE_EPILOGUE.substitute(id='tbl-software').encode('utf-8') yield '<script>make_collapsible(document.getElementById("heading-software"), document.getElementById("tbl-software"));</script>\n'.encode('utf-8') - if (softwarelist_info['notes']): - yield htmltmpl.SOFTWARELIST_EPILOGUE.substitute(notes=htmlescape(softwarelist_info['notes'])).encode('utf-8') - yield '</body>\n</html>\n'.encode('utf-8') def software_page(self, software_info): @@ -722,22 +733,35 @@ class SoftwareListHandler(QueryPageHandler): yield htmltmpl.SORTABLE_TABLE_EPILOGUE.substitute(id='tbl-clones').encode('utf-8') yield '<script>make_collapsible(document.getElementById("heading-clones"), document.getElementById("tbl-clones"));</script>\n'.encode('utf-8') + if software_info['notes'] is not None: + yield htmltmpl.SOFTWARE_NOTES_PROLOGUE.substitute().encode('utf-8') + first = True + for line in software_info['notes'].strip().splitlines(): + if line: + yield (('<p>%s' if first else '<br />\n%s') % (htmlescape(line), )).encode('utf-8') + first = False + elif not first: + yield '</p>\n'.encode('utf-8') + first = True + if not first: + yield '</p>\n'.encode('utf-8') + yield htmltmpl.SOFTWARE_NOTES_EPILOGUE.substitute().encode('utf-8') + parts = self.dbcurs.get_software_parts(software_info['id']).fetchall() first = True for id, partname, interface, part_id in parts: if first: - yield '<h2>Parts</h2>\n'.encode('utf-8') + yield htmltmpl.SOFTWARE_PARTS_PROLOGUE.substitute().encode('utf-8') first = False yield htmltmpl.SOFTWARE_PART_PROLOGUE.substitute( heading=htmlescape(('%s (%s)' % (part_id, partname)) if part_id is not None else partname), shortname=htmlescape(partname), interface=htmlescape(interface)).encode('utf-8') for name, value in self.dbcurs.get_softwarepart_features(id): - yield (' <tr><th>%s:</th><td>%s</td>\n' % (htmlescape(name), htmlescape(value))).encode('utf-8') - yield '</table>\n\n'.encode('utf-8') - - if (software_info['notes']): - yield htmltmpl.SOFTWARE_EPILOGUE.substitute(notes=htmlescape(software_info['notes'])).encode('utf-8') + yield (' <tr><th>%s:</th><td>%s</td>\n' % (htmlescape(name), htmlescape(value))).encode('utf-8') + yield ' </table>\n\n'.encode('utf-8') + if not first: + yield htmltmpl.SOFTWARE_PARTS_EPILOGUE.substitute().encode('utf-8') yield '</body>\n</html>\n'.encode('utf-8') |