Skip to content

@shesek /defaultcols.py
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Default columns for Trac query
# 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
@shesek
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.