Commit 2c53de7a authored by Clément Schreiner's avatar Clément Schreiner
Browse files

Move excessive python code from the template into the controller.

parent 65542944
...@@ -109,6 +109,13 @@ class PackageController(BaseController): ...@@ -109,6 +109,13 @@ class PackageController(BaseController):
else: else:
c.user = None c.user = None
c.plugins = dict()
for package_version in package.package_versions:
pv_plugins = Plugins('qa', package_version)
pv_plugins.load_plugins()
pv_plugins.load_results()
c.plugins[package_version.id] = pv_plugins
log.debug('Rendering page') log.debug('Rendering page')
return render('/package/index.mako') return render('/package/index.mako')
......
...@@ -147,20 +147,16 @@ ...@@ -147,20 +147,16 @@
% endif % endif
</table> </table>
<% % if len(c.plugins[package_version.id]) > 0:
plugins = c.plugins('qa', package_version)
plugins.load_results()
%>
% if len(plugins.results) > 0:
<h3 class="qa-toplevel-header">${ _('QA information') }</h3> <h3 class="qa-toplevel-header">${ _('QA information') }</h3>
<ul class="qa"> <ul class="qa">
## Print result from plugins ## Print result from plugins
% for plugin in plugins.results: % for name, plugin in c.plugins[package_version.id].iteritems():
<li class="severity-${ h.constants.PLUGIN_SEVERITY[1].lower() }"> <li class="severity-${ h.constants.PLUGIN_SEVERITY[plugin.test_severity].lower() }">
<span class="visibility" title="${h.constants.PLUGIN_SEVERITY[1]}">–</span> <span class="visibility" title="${h.constants.PLUGIN_SEVERITY[plugin.test_severity]}">–</span>
${ plugins.plugins[plugin].render(plugins.results[plugin], 'html') | n } ${ plugin.render('html') | n }
</li> </li>
% endfor % endfor
</ul> </ul>
......
Supports Markdown
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