# HG changeset patch # User Aurelien Campeas # Date 1319457099 -7200 # Node ID 6ce4ff44b2cf1d9bcf05e489571a1ea3d786c8d2 # Parent 7b2b8a7fb96dce7e4853dff045990640700446ed [tableview] extract two methods from render_table to ease subclassing diff -r 7b2b8a7fb96d -r 6ce4ff44b2cf web/views/tableview.py --- a/web/views/tableview.py Mon Oct 24 13:19:23 2011 +0200 +++ b/web/views/tableview.py Mon Oct 24 13:51:39 2011 +0200 @@ -203,6 +203,20 @@ facetsform.render(w, vid=self.view.__regid__, cssclass=cssclass, divid=self.view.domid) + def render_table_headers(self, w, colrenderers): + w(u'') + for colrenderer in colrenderers: + w(u'') + colrenderer.render_header(w) + w(u'') + w(u'\n') + + def render_table_body(self, w, colrenderers): + w(u'') + for rownum in xrange(self.view.table_size): + self.render_row(w, rownum, colrenderers) + w(u'') + def render_table(self, w, actions, paginate): view = self.view divid = view.domid @@ -217,17 +231,9 @@ colrenderers = view.build_column_renderers() attrs = self.table_attributes() w(u'' % sgml_attributes(attrs)) - if view.has_headers: - w(u'') - for colrenderer in colrenderers: - w(u'') - w(u'\n') - w(u'') - for rownum in xrange(view.table_size): - self.render_row(w, rownum, colrenderers) - w(u'') + if self.view.has_headers: + self.render_table_headers(w, colrenderers) + self.render_table_body(w, colrenderers) w(u'
') - colrenderer.render_header(w) - w(u'
') if actions and self.display_actions == 'bottom': self.render_actions(w, actions)