Comment 8 for bug 749561

Revision history for this message
James Westby (james-w) wrote : Re: [Bug 749561] Re: please allow targeting a series and set a milestone

Replying to my own message so that LP doesn't reject the Python code as
being commands to its email interface.

On Fri, 08 Apr 2011 09:56:01 -0400, James Westby <email address hidden> wrote:
> On Fri, 08 Apr 2011 11:37:44 -0000, Mattias Backman <email address hidden> wrote:
> > How would you like to specify milestones? I can either take a milestone
> > url option or a milestone name. If we go for name, I think it needs to
> > be already present on the target package (if that means that the
> > milestone must be registered some other way than just having a target
> > milestone already I don't know yet).
>
> As discussed on the phone, I suggest assuming that the milestone is
> already registered. They are infrequently added, especially for Ubuntu,
> and the person running the script doesn't necessarily have the
> permissions to create the milestone.
>
> Also, I suggest using names rather than URLs to be consistent with
> archives. If we want to also support URLs then we should do that across
> the board.
>
> > The same question would apply for the series option, would you prefer
> > name or url? Here I think it has to be a series that's registered on the
> > project, at least the web UI only allows for choosing between the series
> > on the project.
>
> Yep, the series has to already be present for the project/distribution,
> as does the milestone for the series.
>
> So you would do something like
>
> if series_name is not None:
> series = target.getSeries(name=series_name)
> else:
> series = target.current_series
>
> if milestone_name is not None:
> milestone = series.getMilestone(name=milestone_name)
>
> if series_name is not None:
> bug.addNomination(target=series)
>
> if milestone_name is not None:
> bug_task.milestone = milestone
> bug_task.lp_save()
>
> Assuming that you only create one bug task. If there is more than one
> I'm not sure how to decide which should get the series/milestone.
>
> Also, I'm not sure how milestones and nominations interact. If the
> person has certain permissions on the bug target then their nomination
> will immediately create a new bug task. If that happens then we again
> have to decide which gets the milestone. If it doesn't then the task
> that is present may be for a series that doesn't have the desired
> milestone.
>
> I think we are going to have to leave some of this up to the person
> running the script, e.g. they can't choose a milestone and series for
> which they can't immediately create the bugtask with addNomination.
>
> If I've made things unclear then let me know, and I'll try and help come
> up with a solution.
>
> Thanks,
>
> James