← Back to team overview

launchpad-dev team mailing list archive

Re: Help please - launchpadlib collections

 

On Thu, Apr 12, 2012 at 2:11 PM, William Grant
<william.grant@xxxxxxxxxxxxx> wrote:
> On 12/04/12 11:17, Ian Booth wrote:
>> Hi James
>>
>>>
>>> Firstly I wanted to note that lp.projects is a heterogenous collection
>>> isn't it? You can access both projects and project groups with it, and
>>> don't they have a different interface?
>>>
>>
>> AFAIK, project groups are handled separately, using lp.project_groups
>
> lp.projects['fooprojectgroup'] happens to work because launchpadlib's
> ProjectSet generates a URL of /fooprojectgroup, and that URL namespace
> is shared between projects, distributions and project groups. The
> returned interfaces are heterogeneous because of exactly the hack that
> Ian proposes as the easy solution -- indexing a client-defined
> collection like ProjectSet just generates a URL with a known structure
> and requests that resource, respecting whatever resource type is returned.

Right, and thats why I'm saying the previously sketched thing of
respecting such information consistently will reduce the special
casing code, close of a couple of long standing bugs, be easier to
maintain and work with.

So I rejected your MP and pointed you at the root cause. It still lets
you expose a collection of services but you don't need the special
casing. I don't think it is a distraction in any way.

-Rob


Follow ups

References