fix selector of EntityRelatedTab, next step is to find a way to avoid this kind of selector tls-sprint
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Wed, 18 Feb 2009 11:41:35 +0100
branchtls-sprint
changeset 771 ae1b0081ff30
parent 770 193b7e981ea9
child 772 97b2b582e7f7
fix selector of EntityRelatedTab, next step is to find a way to avoid this kind of selector
web/views/tabs.py
--- a/web/views/tabs.py	Wed Feb 18 11:40:25 2009 +0100
+++ b/web/views/tabs.py	Wed Feb 18 11:41:35 2009 +0100
@@ -11,6 +11,7 @@
 from logilab.mtconverter import html_escape
 
 from cubicweb import NoSelectableObject, role
+from cubicweb.vregistry import objectify_selector
 from cubicweb.selectors import has_related_entities
 from cubicweb.common.view import EntityView
 from cubicweb.common.utils import HTMLHead
@@ -143,7 +144,14 @@
     class ProjectScreenshotTab(DataDependantTab, ProjectScreenshotsView):
         id = 'screenshots_tab'
     """
-    __select__ = EntityView.__select__ & (has_related_entities,)
+    # XXX needs to be generalized
+    @objectify_selector
+    def my_selector(cls, req, rset, row=None, col=0, **kwargs):
+        selector = (EntityView.__select__ &
+                    has_related_entities(cls.rtype, role(cls)))
+        return selector(cls, req, rset, row=None, col=0, **kwargs)
+
+    __select__ = my_selector()
     vid = 'list'
 
     def cell_call(self, row, col):