← Back to team overview

launchpad-dev team mailing list archive

Exposing a dict on the LP API, was: [Bug 352094] Expose ISourcePackage.branches

 

How does one expose a property that's a dict on the LP API? Are there
any examples of this?

-------- Original Message --------
Subject: Re: [Bug 352094] Re: Expose ISourcePackage.branches
Date: Fri, 23 Oct 2009 18:37:27 -0000
From: Jonathan Lange <jml@xxxxxxxxx>
Reply-To: Bug 352094 <352094@xxxxxxxxxxxxxxxxxx>
To: muharem@xxxxxxxxxxxxx
References:
<20090331021258.7848.65896.malonedeb@xxxxxxxxxxxxxxxxxxxxxx>
<20091023182256.13536.41041.malone@xxxxxxxxxxxxxxxxxxxxxx>

On Fri, Oct 23, 2009 at 7:22 PM, Muharem Hrnjadovic
<muharem@xxxxxxxxxxxxx> wrote:
> Hmm .. interesting. IMHO the `ISeriesSourcePackageBranch` class has
> nothing to it that would preclude it from external exposure. Why is it
> banned from all APIs?
>

Because it's a boring implementation detail of no actual use. It's
sole purpose is to allow us to associate a mapping from pocket ->
branch with each source package.

If we weren't using an ORM, it wouldn't be a class at all.

> The ISourcePackage.linked_branches() method returns a collection of
>
>   (SeriesSourcePackageBranch.pocket, Branch) tuples
>
> which makes it difficult to declare its return type using something like
> @operation_returns_collection_of(). Or am I missing something?
>

TBH, I'm not sure why it's a list of tuples rather than a dict. I don't
know how to expose a dict over the API. Surely someone has done it
before though.

jml

Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups