[views] fix TestExecution's primary view (w/ execution_archive) (closes #5380853)
authorDavid Douard <david.douard@logilab.fr>
Thu, 21 May 2015 18:00:49 +0200
changeset 1816 a7a7d684ab9b
parent 1789 4c12479f1c70
child 1817 3c65c9e316bc
[views] fix TestExecution's primary view (w/ execution_archive) (closes #5380853) it was still using the long deprecated (and now removed) idownloadable.download_box function.
views/testexecution.py
--- a/views/testexecution.py	Mon Feb 02 16:06:37 2015 +0100
+++ b/views/testexecution.py	Thu May 21 18:00:49 2015 +0200
@@ -19,7 +19,7 @@
 from cubicweb import Unauthorized, tags
 from cubicweb.predicates import is_instance, none_rset, score_entity
 from cubicweb.view import EntityView
-from cubicweb.web import box
+from cubicweb.web import box, component
 from cubicweb.web.views import tabs, tableview, baseviews, uicfg
 from cubicweb.web.views import ibreadcrumbs, idownloadable, navigation
 
@@ -341,15 +341,12 @@
                entity.absolute_url(), self._cw._('view details'), status))
 
 
-class TEDownloadBox(box.EntityBoxTemplate):
-    __regid__ = 'apycot.te.download_box'
-    __select__ = (box.EntityBoxTemplate.__select__ & is_instance('TestExecution') &
+class TEArchiveDownloadBox(idownloadable.DownloadBox):
+    __select__ = (component.EntityCtxComponent.__select__ &
+                  is_instance('TestExecution') &
                   score_entity(lambda x: x.execution_archive))
-
-    def cell_call(self, row, col, **kwargs):
-        archive = self.cw_rset.get_entity(row, col).execution_archive[0]
-        idownloadable.download_box(self.w, archive,
-                                   self._cw._('download execution environment'))
+    def init_rendering(self):
+        self.items = self.entity.execution_archive
 
 
 class TEIBreadCrumbsAdapter(ibreadcrumbs.IBreadCrumbsAdapter):