#9667 closed defect (fixed)
[PATCH] __color__ column in csv reports
Reported by: | Owned by: | Remy Blank | |
---|---|---|---|
Priority: | normal | Milestone: | 0.12.2 |
Component: | report system | Version: | 0.12-stable |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: |
In reports, strip special columns like |
||
API Changes: | |||
Internal Changes: |
Description
On a new Trac instance http://localhost:8080/report/1?asc=1&format=csv returns a __color__
column for csv reports:
__color__,ticket,summary,component,version,milestone,type,owner,status,created,_changetime,_description,_reporter 3,1,sdsad,component1,,,defect,somebody,new,2010-09-29T00:10:30+02:00,2010-09-29T00:48:11+02:00,[[TracAdminHelp(upgrade)]],admin 3,2,sdsadsa,component1,,,defect,somebody,new,2010-09-29T00:10:36+02:00,2010-09-29T00:10:36+02:00,dsadsdsadasdas,admin 3,3,sadsadsdasdas,component1,,,defect,somebody,new,2010-09-29T00:10:43+02:00,2010-09-29T00:10:43+02:00,sadsadasd,admin
Attachments (2)
Change History (9)
by , 14 years ago
Attachment: | color-csv.patch added |
---|
comment:2 by , 14 years ago
The previous patch didn't remove the row's first cell, only the column header, this patch should fix that (and also exclude other style-related rows):
-
trac/ticket/report.py
478 478 # - group rows according to __group__ value, if defined 479 479 # - group cells the same way headers are grouped 480 480 row_groups = [] 481 authorized_results = [] 481 authorized_results = [] 482 extra_row_props = ['__style__', '__color__', '__fgcolor__', 483 '__bgcolor__', '__grouplink__'] 482 484 prev_group_value = None 483 485 for row_idx, result in enumerate(results): 484 486 col_idx = 0 … … 501 503 (Chrome(self.env).format_author(req, value), []) ) 502 504 # Other row properties 503 505 row['__idx__'] = row_idx 504 if col in ('__style__', '__color__', 505 '__fgcolor__', '__bgcolor__', 506 '__grouplink__'): 506 if col in extra_row_props: 507 507 row[col] = value 508 508 if col in ('report', 'ticket', 'id', '_id'): 509 509 row['id'] = value … … 539 539 'numrows': numrows, 540 540 'sorting_enabled': len(row_groups) == 1}) 541 541 542 if format == 'csv' or format == 'tab': 543 for exclude in extra_row_props: 544 try: 545 clr = cols.index(exclude) 546 cols.pop(clr) 547 for row in authorized_results: 548 row.pop(clr) 549 except ValueError: 550 pass 551 542 552 if format == 'rss': 543 553 data['email_map'] = Chrome(self.env).get_email_map() 544 554 data['context'] = Context.from_request(req, report_resource,
comment:3 by , 14 years ago
Keywords: | review added |
---|---|
Summary: | __color__ column in csv reports → [PATCH] __color__ column in csv reports |
by , 14 years ago
Attachment: | 9667-special-cols-r10233.patch added |
---|
Different fix, directly in _send_csv()
.
comment:4 by , 14 years ago
Could you please test 9667-special-cols-r10233.patch? It solves the issue slightly differently, by filtering the columns in _send_csv()
, so it doesn't have to mutate all results.
comment:5 by , 14 years ago
Keywords: | review removed |
---|
Thanks, that patch is much cleaner and works properly on http://localhost:8000/trac-test-instance/report/1?asc=1&format=csv. If I check the 'My Tickets' link on http://localhost:8000/trac-test-instance/report/7 it contains a __group__
column. Even though it it's not part of this ticket description, would be nice to get rid of that one as well.
comment:6 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Thanks for testing. About the __group__
column, it could be removed easily by adding it to the _special_cols
set, but I'm not sure this is desired.
All other special columns only have meaning when rendered as HTML. The __group__
column, however, represents the grouping information for the report, and removing it changes the meaning of the report. So I would rather leave it in.
Patch above (with a small change in name to better identify the removed special columns) applied in [10247].
comment:7 by , 14 years ago
Release Notes: | modified (diff) |
---|
remove color property