Ticket #5806: 5806_fix.patch
| File 5806_fix.patch, 6.3 KB (added by François Terrier <fterrier@…>, 3 years ago) |
|---|
-
trac/ticket/report.py
354 354 'col': col, 355 355 'title': col.strip('_').capitalize(), 356 356 'hidden': False, 357 'asc': False 357 'asc': False, 358 'type': col 358 359 } 359 360 360 361 if col == sort_col: … … 404 405 # Structure the rows and cells: 405 406 # - group rows according to __group__ value, if defined 406 407 # - group cells the same way headers are grouped 408 type_warnings = [] 407 409 row_groups = [] 408 410 prev_group_value = None 409 411 for row_idx, result in enumerate(results): … … 438 440 email_cells.append(cell) 439 441 elif col == 'realm': 440 442 realm = value 443 444 # Fix bug #5806, if results come from a db query, we must check 445 # the types before sending to the template engine, for now 446 # we just prefix the type with 'sql.' 447 if (col == 'time' 448 or col in ['date', 'created', 'modified'] 449 or col == 'datetime'): 450 if not re.match(r"[0-9]*$", value): 451 header['type'] = "sql." + header['type'] 452 type_warnings.append(col) 453 441 454 cell_group.append(cell) 442 455 cell_groups.append(cell_group) 443 456 resource = Resource(realm, row.get('id')) … … 457 470 row_groups = [(None, row_group)] 458 471 row_group.append(row) 459 472 473 for type_warning in set(type_warnings): 474 add_warning(req, 475 _("Using a reserved column name (%s) with " 476 "an incompatible type" % type_warning)) 477 460 478 # Get the email addresses of all known users 461 479 email_map = {} 462 480 if Chrome(self.env).show_email_addresses: -
trac/ticket/templates/report_view.html
119 119 120 120 <py:for each="cell in cell_group"> 121 121 <py:if test="not cell.header.hidden"> 122 <py:with vars="col = cell.header.col.strip('_') ">122 <py:with vars="col = cell.header.col.strip('_'); type = cell.header.type"> 123 123 <py:choose> 124 124 125 125 <!--! for the report listing --> 126 <py:when test=" col== 'report'">126 <py:when test="type == 'report'"> 127 127 <td class="$col" py:attrs="td_attrs"> 128 128 <a title="View report" href="${href.report(cell.value)}">{$cell.value}</a> 129 129 <hr py:if="fullrow"/> 130 130 </td> 131 131 </py:when> 132 132 133 <py:when test=" col== 'title' and report.id == -1">133 <py:when test="type == 'title' and report.id == -1"> 134 134 <td class="$col" py:attrs="td_attrs"> 135 135 <a title="View report" href="${href.report(row.id)}">$cell.value</a> 136 136 <hr py:if="fullrow"/> … … 138 138 </py:when> 139 139 140 140 <!--! for the ticket listing --> 141 <py:when test=" colin ('ticket', 'id')">141 <py:when test="type in ('ticket', 'id')"> 142 142 <td class="ticket" py:attrs="td_attrs"> 143 143 <a title="View ${row.resource.realm}" href="${url_of(row.resource)}">#$cell.value</a> 144 144 <hr py:if="fullrow"/> 145 145 </td> 146 146 </py:when> 147 147 148 <py:when test=" col== 'summary' and row.id">148 <py:when test="type == 'summary' and row.id"> 149 149 <td class="$col" py:attrs="td_attrs"> 150 150 <a title="View ${row.resource.realm}" href="${url_of(row.resource)}">$cell.value</a> 151 151 <hr py:if="fullrow"/> … … 153 153 </py:when> 154 154 155 155 <!--! generic fields --> 156 <py:when test=" col== 'time'">156 <py:when test="type == 'time'"> 157 157 <td class="date" py:attrs="td_attrs">${cell.value != '' and format_time(int(cell.value)) or '--'} 158 158 <hr py:if="fullrow"/> 159 159 </td> 160 160 </py:when> 161 162 <py:when test="colin ('date', 'created', 'modified')">161 162 <py:when test="type in ('date', 'created', 'modified')"> 163 163 <td class="date" py:attrs="td_attrs">${cell.value != '' and format_date(int(cell.value)) or '--'} 164 164 <hr py:if="fullrow"/> 165 165 </td> 166 166 </py:when> 167 167 168 <py:when test=" col== 'datetime'">168 <py:when test="type == 'datetime'"> 169 169 <td class="date" py:attrs="td_attrs">${cell.value != '' and format_datetime(int(cell.value)) or '--'} 170 170 <hr py:if="fullrow"/> 171 171 </td> 172 172 </py:when> 173 173 174 <py:when test=" col== 'description'">174 <py:when test="type == 'description'"> 175 175 <td class="$col" py:attrs="td_attrs" xml:space="preserve"> 176 176 ${wiki_to_html(context(row.resource), cell.value)} 177 177 <hr py:if="fullrow"/> 178 178 </td> 179 179 </py:when> 180 180 181 <py:when test=" col== 'milestone'">181 <py:when test="type == 'milestone'"> 182 182 <td class="$col" py:attrs="td_attrs"> 183 183 <a title="View milestone" href="${href.milestone(cell.value)}">$cell.value</a> 184 184 <hr py:if="fullrow"/>
