You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@allura.apache.org by Edit Mera <em...@donay.com> on 2013/05/15 11:43:34 UTC

ticket search by id and project

Can project be used in Ticket search?
If not, how can I get a Ticket object in an extension tool controller
method, knowing the ticket_num and the project?
Or is there a way to get the ForgeTrackerApp config._id in an extension
tool?
Thanks in advance.

Re: ticket search by id and project

Posted by Dave Brondsema <da...@brondsema.net>.
Tickets (like most artifacts) are associated with a tool (a.k.a. app) instance,
not with a project directly.  This is because you can have multiple ticket tools
installed within one project.  To get the app config id(s) for a project, use
something like this:

# this is the full app_config objects:
acs = project.app_configs

# just their _id values:
ids = [ac._id for ac in project.app_configs]

# limit to Ticket tools:
ids = [ac._id for ac in project.app_configs if ac.tool_name=='Tickets']

And then you can search for tickets with a query like {"app_config_id": {"$in":
ids}}


On 5/15/13 5:43 AM, Edit Mera wrote:
> Can project be used in Ticket search?
> If not, how can I get a Ticket object in an extension tool controller
> method, knowing the ticket_num and the project?
> Or is there a way to get the ForgeTrackerApp config._id in an extension
> tool?
> Thanks in advance.
> 



-- 
Dave Brondsema : dave@brondsema.net
http://www.brondsema.net : personal
http://www.splike.com : programming
              <><