web/component.py
changeset 10006 8391bf718485
parent 9915 020d2e453e6f
child 10040 2ddeece84808
--- a/web/component.py	Fri May 02 17:41:11 2014 +0200
+++ b/web/component.py	Fri May 02 17:57:37 2014 +0200
@@ -270,7 +270,7 @@
     layout_id = None # to be defined in concret class
     layout_args = {}
 
-    def layout_render(self, w):
+    def layout_render(self, w, **kwargs):
         getlayout = self._cw.vreg['components'].select
         layout = getlayout(self.layout_id, self._cw, **self.layout_select_args())
         layout.render(w)
@@ -331,19 +331,8 @@
     title = None
     layout_id = 'component_layout'
 
-    # XXX support kwargs for compat with old boxes which gets the view as
-    # argument
     def render(self, w, **kwargs):
-        if hasattr(self, 'call'):
-            warn('[3.10] should not anymore implement call on %s, see new CtxComponent api'
-                 % self.__class__, DeprecationWarning)
-            self.w = w
-            def wview(__vid, rset=None, __fallback_vid=None, **kwargs):
-                self._cw.view(__vid, rset, __fallback_vid, w=self.w, **kwargs)
-            self.wview = wview
-            self.call(**kwargs) # pylint: disable=E1101
-            return
-        self.layout_render(w)
+        self.layout_render(w, **kwargs)
 
     def layout_select_args(self):
         args = super(CtxComponent, self).layout_select_args()
@@ -410,19 +399,6 @@
     def separator(self):
         return Separator()
 
-    @deprecated('[3.10] use action_link() / link()')
-    def box_action(self, action): # XXX action_link
-        return self.build_link(self._cw._(action.title), action.url())
-
-    @deprecated('[3.10] use action_link() / link()')
-    def build_link(self, title, url, **kwargs):
-        if self._cw.selected(url):
-            try:
-                kwargs['klass'] += ' selected'
-            except KeyError:
-                kwargs['klass'] = 'selected'
-        return tags.a(title, href=url, **kwargs)
-
 
 class EntityCtxComponent(CtxComponent):
     """base class for boxes related to a single entity"""
@@ -725,30 +701,3 @@
     def entity_call(self, entity, view=None):
         raise NotImplementedError()
 
-
-class RelatedObjectsVComponent(EntityVComponent):
-    """a section to display some related entities"""
-    __select__ = EntityVComponent.__select__ & partial_has_related_entities()
-
-    vid = 'list'
-    # to be defined in concrete classes
-    rtype = title = None
-
-    def rql(self):
-        """override this method if you want to use a custom rql query"""
-        return None
-
-    def cell_call(self, row, col, view=None):
-        rql = self.rql()
-        if rql is None:
-            entity = self.cw_rset.get_entity(row, col)
-            rset = entity.related(self.rtype, role(self))
-        else:
-            eid = self.cw_rset[row][col]
-            rset = self._cw.execute(self.rql(), {'x': eid})
-        if not rset.rowcount:
-            return
-        self.w(u'<div class="%s">' % self.cssclass)
-        self.w(u'<h4>%s</h4>\n' % self._cw._(self.title).capitalize())
-        self.wview(self.vid, rset)
-        self.w(u'</div>')