← Back to team overview

launchpad-dev team mailing list archive

Re: API issue moving branches

 

There is no reason for setTarget to take to paremeters.

The signature should be setTarget(new_target)

The implementation should map the proper target to the relevant internal 
storage fields.

-- 
Francis J. Lacoste
francis.lacoste@xxxxxxxxxxxxx

On May 10, 2010, Leonard Richardson wrote:
> > I agree with Francis, but I'd also like to add that it seems hard to
> > expose 'never both' over API's AIUI - that is, setTarget doesn't
> > permit both package and project to be set, but individual fields would
> > permit that.
> 
> If the individual fields have setTarget() as their mutator, then any
> attempt to set both 'package' and 'project' would fail, just as any
> attempt to invoke setTarget(package=foo, project=bar) would fail. Any
> attempt to set 'package' when 'project' is already set would implicitly
> clear out 'project'.
> 
> I take Francis's general point that we should think about the API that
> will feel most natural to the end-user, rather than publishing our
> internal API directly.
> 
> I also take his specific point that having a single, polymorphous
> 'target' field > two fields > named operation. You can set 'target' to a
> package or a project, if you need to see what kind of object the target
> is you can GET it, if you want there to be no target you can set a
> single field to None.
> 
> Leonard

Attachment: signature.asc
Description: This is a digitally signed message part.


References