Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Default columns for Trac query

View defaultcols.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
# Adds a new `default_cols` option under [query] with a comma-separated list of default columns
# See http://trac-hacks.org/wiki/DefaultColsPlugin
 
from trac.core import *
from trac.web.main import IRequestFilter
from trac.config import ListOption
 
class DefaultCols(Component):
implements(IRequestFilter)
 
default_cols = ListOption('query', 'default_cols', default=None,
doc="""List of columns to show in query unless defined by the query.""")
 
# -- IRequestFilter
def pre_process_request(self, req, handler):
if self.default_cols != None and req.path_info == '/query' and 'col' not in req.args:
req.args['col'] = self.default_cols
return handler
 
def post_process_request(self, req, template, data, content_type):
return template, data, content_type
Owner

There's work in progress at #10425 to get this functionality into core, but in the meanwhile you can use this plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.