QueryAllPlugin

0 views
Skip to first unread message

Alesh Slovak

unread,
Mar 12, 2008, 2:40:35 AM3/12/08
to Trac Development
Hi,

I am currently working on a new plugin called QueryAllPlugin. The goal
of this plugin is to be able to do ticket queries across multiple projects.

My prototype implementation basically amounts to the SearchAllPlugin
with part of QueryModule.process_request() grafted into it. It works
insofar as it lists tickets from multiple projects in the custom query
page, but it is quite fragile.

What I was trying to do is to get the actual query string from Trac so I
can pass it directly to Query.from_string() instead of having to go the
round about way through QueryModule. The Request object only gives me
'/query' without any of the actual query text. Is there some way to get
this from Trac? If not, is there some better way to go about this than
my little hack mentioned above?

Thanks,

Alesh

Erik Bray

unread,
Mar 12, 2008, 2:45:21 PM3/12/08
to trac...@googlegroups.com
I ran into this problem myself a little while back--the problem with
Query.from_string() is that it creates a Query from Trac's custom
query syntax, not from a URL query string. (Counterintuitively,
Query.to_string() just generates a modified URL query string, and not
the Trac query language. There's a comment in the docstring about
fixing that.) What there should probably be is a Query.from_href() or
something like that. I've considered submitting a patch along those
lines. In the meantime, I had to steal code from
QueryModule.process_request() for building up the Query object.

Erik

Alesh Slovak

unread,
Mar 14, 2008, 4:46:44 AM3/14/08
to trac...@googlegroups.com
I managed to figure out how to grab a QueryModule object from other
environments, so now I don't need to do any nasty copy-pasting. However,
my next problem is that I would like to get filtering by Project to work.

I could add a custom ticket field for Project, but I would like to avoid
that if possible. Basically what I need is the ability to create a
"meta" ticket field and populate it on the fly based on which project
the ticket came from. I can then filter the results myself.

I can add a Project filter to the filters list, but its value is not
saved in the session and it disappears. What I would like to know is if
what I am trying to do is possible (and how) or if adding a custom
ticket field in the ini file is the only way to get this to work.

Thanks,

Alesh

Reply all
Reply to author
Forward
0 new messages