web/views/pyviews.py
branchstable
changeset 4863 f6cf0fcd40ae
parent 4252 6c4f109c2b03
child 5421 8167de96c523
equal deleted inserted replaced
4862:0d0e5279f65e 4863:f6cf0fcd40ae
    15     __select__ = match_kwargs('pyvalue')
    15     __select__ = match_kwargs('pyvalue')
    16 
    16 
    17     def call(self, pyvalue, headers=None):
    17     def call(self, pyvalue, headers=None):
    18         if headers is None:
    18         if headers is None:
    19             headers = self._cw.form.get('headers')
    19             headers = self._cw.form.get('headers')
    20         self.w(u'<table class="listing">\n')
    20         w = self.w
       
    21         w(u'<table class="listing">\n')
    21         if headers:
    22         if headers:
    22             self.w(u'<tr>')
    23             w(u'<thead>')
       
    24             w(u'<tr>')
    23             for header in headers:
    25             for header in headers:
    24                 self.w(u'<th>%s</th>' % header)
    26                 w(u'<th>%s</th>' % header)
    25             self.w(u'</tr>\n')
    27             w(u'</tr>\n')
       
    28             w(u'</thead>')
       
    29         w(u'<tbody>')
    26         for row in pyvalue:
    30         for row in pyvalue:
    27             self.w(u'<tr>')
    31             w(u'<tr>')
    28             for cell in row:
    32             for cell in row:
    29                 self.w(u'<td>%s</td>' % cell)
    33                 w(u'<td>%s</td>' % cell)
    30             self.w(u'</tr>\n')
    34             w(u'</tr>\n')
    31         self.w(u'</table>\n')
    35         w(u'</tbody>')
       
    36         w(u'</table>\n')
    32 
    37 
    33 
    38 
    34 class PyValListView(View):
    39 class PyValListView(View):
    35     __regid__ = 'pyvallist'
    40     __regid__ = 'pyvallist'
    36     __select__ = match_kwargs('pyvalue')
    41     __select__ = match_kwargs('pyvalue')