view.py
branchstable
changeset 6922 cb1dd14a768f
parent 6909 b8171392de16
child 6926 2cda8f1b4fae
equal deleted inserted replaced
6921:c1fdf590712f 6922:cb1dd14a768f
   162         * if row is specified, `cell_call` is called
   162         * if row is specified, `cell_call` is called
   163         * if none of them is supplied, the view is considered to apply on
   163         * if none of them is supplied, the view is considered to apply on
   164           the whole result set (which may be None in this case), `call` is
   164           the whole result set (which may be None in this case), `call` is
   165           called
   165           called
   166         """
   166         """
       
   167         # XXX use .cw_row/.cw_col
   167         row = context.get('row')
   168         row = context.get('row')
   168         if row is not None:
   169         if row is not None:
   169             context.setdefault('col', 0)
   170             context.setdefault('col', 0)
   170             view_func = self.cell_call
   171             view_func = self.cell_call
   171         else:
   172         else:
   208         """
   209         """
   209         rset = self.cw_rset
   210         rset = self.cw_rset
   210         if rset is None:
   211         if rset is None:
   211             raise NotImplementedError, (self, "an rset is required")
   212             raise NotImplementedError, (self, "an rset is required")
   212         wrap = self.templatable and len(rset) > 1 and self.add_div_section
   213         wrap = self.templatable and len(rset) > 1 and self.add_div_section
   213         # XXX propagate self.extra_kwars?
   214         # avoid re-selection if rset of size 1, we already have the most
   214         for i in xrange(len(rset)):
   215         # specific view
       
   216         if rset.rowcount != 1:
       
   217             kwargs.setdefault('initargs', self.cw_extra_kwargs)
       
   218             for i in xrange(len(rset)):
       
   219                 if wrap:
       
   220                     self.w(u'<div class="section">')
       
   221                 self.wview(self.__regid__, rset, row=i, **kwargs)
       
   222                 if wrap:
       
   223                     self.w(u"</div>")
       
   224         else:
   215             if wrap:
   225             if wrap:
   216                 self.w(u'<div class="section">')
   226                 self.w(u'<div class="section">')
   217             self.wview(self.__regid__, rset, row=i, **kwargs)
   227             kwargs.setdefault('col', 0)
       
   228             self.cell_call(row=0, **kwargs)
   218             if wrap:
   229             if wrap:
   219                 self.w(u"</div>")
   230                 self.w(u"</div>")
   220 
   231 
   221     def cell_call(self, row, col, **kwargs):
   232     def cell_call(self, row, col, **kwargs):
   222         """the view is called for a particular result set cell"""
   233         """the view is called for a particular result set cell"""