web/views/tableview.py
branchtls-sprint
changeset 742 99115e029dca
parent 692 800592b8d39b
child 762 a6f678fe7e44
equal deleted inserted replaced
739:39721e56b56d 742:99115e029dca
     3 
     3 
     4 :organization: Logilab
     4 :organization: Logilab
     5 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     5 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     6 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     6 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     7 """
     7 """
     8 from __future__ import with_statement
       
     9 
       
    10 __docformat__ = "restructuredtext en"
     8 __docformat__ = "restructuredtext en"
    11 
     9 
    12 from simplejson import dumps
    10 from simplejson import dumps
    13 
    11 
    14 from logilab.mtconverter import html_escape
    12 from logilab.mtconverter import html_escape
   221             columns.append(column)
   219             columns.append(column)
   222         return columns
   220         return columns
   223         
   221         
   224 
   222 
   225     def render(self, cellvid, row, col, w):
   223     def render(self, cellvid, row, col, w):
   226         from cubicweb.selectors import traced_selection
   224         self.view('cell', self.rset, row=row, col=col, cellvid=cellvid, w=w)
   227         with traced_selection( ('cell',) ):
       
   228             self.view('cell', self.rset, row=row, col=col, cellvid=cellvid, w=w)
       
   229         
   225         
   230     def get_rows(self):
   226     def get_rows(self):
   231         return self.rset
   227         return self.rset
   232 
   228 
   233     @htmlescape
   229     @htmlescape
   254     finalview = 'editable-final'
   250     finalview = 'editable-final'
   255     title = _('editable-table')
   251     title = _('editable-table')
   256 
   252 
   257     
   253     
   258 class CellView(EntityView):
   254 class CellView(EntityView):
   259     __selectors__ = (nonempty_rset, accept_rset)
   255     __select__ = nonempty_rset()
   260     # XXX backport implements('Any') ??
       
   261     
   256     
   262     id = 'cell'
   257     id = 'cell'
   263     
   258     
   264     def cell_call(self, row, col, cellvid=None):
   259     def cell_call(self, row, col, cellvid=None):
   265         """
   260         """
   290       
   285       
   291     * the actual query (`actualrql` form parameter) whose results will be
   286     * the actual query (`actualrql` form parameter) whose results will be
   292       displayed with default restrictions set
   287       displayed with default restrictions set
   293     """
   288     """
   294     id = 'initialtable'
   289     id = 'initialtable'
   295     __selectors__ = nonempty_rset, match_form_params
   290     __select__ = nonempty_rset() & match_form_params('actualrql')
   296     form_params = ('actualrql',)
       
   297     # should not be displayed in possible view since it expects some specific
   291     # should not be displayed in possible view since it expects some specific
   298     # parameters
   292     # parameters
   299     title = None
   293     title = None
   300     
   294     
   301     def call(self, title=None, subvid=None, headers=None, divid=None,
   295     def call(self, title=None, subvid=None, headers=None, divid=None,