web/views/tableview.py
branchtls-sprint
changeset 1635 866563e2d0fc
parent 1370 c1cf86a66e30
child 1730 cec526a96535
--- a/web/views/tableview.py	Mon May 04 10:52:00 2009 +0200
+++ b/web/views/tableview.py	Mon May 04 11:47:33 2009 +0200
@@ -14,7 +14,8 @@
 from cubicweb.selectors import nonempty_rset, match_form_params
 from cubicweb.utils import make_uid
 from cubicweb.view import EntityView, AnyRsetView
-from cubicweb.common.uilib import toggle_action, limitsize, jsonize, htmlescape
+from cubicweb.common.uilib import toggle_action, limitsize, htmlescape
+from cubicweb.web import jsonize
 from cubicweb.web.htmlwidgets import (TableWidget, TableColumn, MenuWidget,
                                       PopupBoxMenu, BoxLink)
 from cubicweb.web.facet import prepare_facets_rqlst, filter_hiddens
@@ -44,7 +45,7 @@
                                         'displayfilter': displayfilter})
             return self.show_hide_actions(divid, not hidden)
         return ()
-    
+
     def _generate_form(self, divid, baserql, fwidgets, hidden=True, vidargs={}):
         """display a form to filter table's content. This should only
         occurs when a context eid is given
@@ -88,7 +89,7 @@
             else:
                 displaycols = range(len(self.rset.syntax_tree().children[0].selection))
         return displaycols
-    
+
     def call(self, title=None, subvid=None, displayfilter=None, headers=None,
              displaycols=None, displayactions=None, actions=(), divid=None,
              cellvids=None, cellattrs=None):
@@ -169,7 +170,7 @@
         if currentlydisplayed:
             return [(showhide, showlabel, 'hidden', '%sShow' % divid),
                     (showhide, hidelabel, None, '%sHide' % divid)]
-        return [(showhide, showlabel, None, '%sShow' % divid), 
+        return [(showhide, showlabel, None, '%sShow' % divid),
                 (showhide, hidelabel, 'hidden', '%sHide' % divid)]
 
     def render_actions(self, divid, actions):
@@ -184,7 +185,7 @@
             menu.append(BoxLink(url, label, klass, ident=ident, escape=True))
         box.render(w=self.w)
         self.w(u'<div class="clear"/>')
-        
+
     def get_columns(self, rqlstdescr, displaycols, headers, subvid, cellvids,
                     cellattrs, mainindex):
         columns = []
@@ -218,11 +219,11 @@
             # add column
             columns.append(column)
         return columns
-        
+
 
     def render(self, cellvid, row, col, w):
         self.view('cell', self.rset, row=row, col=col, cellvid=cellvid, w=w)
-        
+
     def get_rows(self):
         return self.rset
 
@@ -251,12 +252,12 @@
     finalview = 'editable-final'
     title = _('editable-table')
 
-    
+
 class CellView(EntityView):
     __select__ = nonempty_rset()
-    
+
     id = 'cell'
-    
+
     def cell_call(self, row, col, cellvid=None):
         """
         :param row, col: indexes locating the cell value in view's result set
@@ -277,13 +278,13 @@
 
 class InitialTableView(TableView):
     """same display as  table view but consider two rql queries :
-    
+
     * the default query (ie `rql` form parameter), which is only used to select
       this view and to build the filter form. This query should have the same
       structure as the actual without actual restriction (but link to
       restriction variables) and usually with a limit for efficiency (limit set
       to 2 is advised)
-      
+
     * the actual query (`actualrql` form parameter) whose results will be
       displayed with default restrictions set
     """
@@ -292,7 +293,7 @@
     # should not be displayed in possible view since it expects some specific
     # parameters
     title = None
-    
+
     def call(self, title=None, subvid=None, headers=None, divid=None,
              displaycols=None, displayactions=None):
         """Dumps a table displaying a composite query"""