no need for both EntityRelatedTab / EntityRelatedView which are doing the same thing tls-sprint
authorsylvain.thenault@logilab.fr
Fri, 20 Feb 2009 01:49:39 +0100
branchtls-sprint
changeset 885 b101d2ae80b4
parent 884 969c16600fb3
child 886 0b417be91dca
no need for both EntityRelatedTab / EntityRelatedView which are doing the same thing
web/views/tabs.py
--- a/web/views/tabs.py	Fri Feb 20 01:49:00 2009 +0100
+++ b/web/views/tabs.py	Fri Feb 20 01:49:39 2009 +0100
@@ -122,10 +122,10 @@
         'cookiename' : self.cookie_name})
 
 
-class EntityRelatedTab(EntityView):
-    """A view you should inherit from leftmost,
-    to wrap another actual view displaying entity related stuff.
-    Such a view _must_ provide the rtype, target and vid attributes :
+
+class EntityRelationView(EntityView):
+    """view displaying entity related stuff. Such a view _must_ provide rtype
+    and target attributes
 
     Example :
 
@@ -135,20 +135,16 @@
         __select__ = implements('Project')
         rtype = 'screenshot'
         target = 'object'
-        vid = 'gallery'
-
-    This is the view we want to have in a tab, only if there is something to show.
-    Then, just define as below, and declare this being the tab content :
-
-    class ProjectScreenshotTab(DataDependantTab, ProjectScreenshotsView):
-        id = 'screenshots_tab'
     """
     __select__ = EntityView.__select__ & partial_has_related_entities()
-                                                          
     vid = 'list'
-
+    
     def cell_call(self, row, col):
-        rset = self.entity(row, col).related(self.rtype, role(self))
+        rset = self.rset.get_entity(row, col).related(self.rtype, role(self))
+        self.w(u'<h1>%s</h1>' % self.req._(self.title).capitalize())
         self.w(u'<div class="mainInfo">')
         self.wview(self.vid, rset, 'noresult')
         self.w(u'</div>')
+
+from logilab.common.deprecation import class_moved
+EntityRelatedTab = class_moved(EntityRelationView)