launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #03165
Re: Heads Up: Possible errors from exporting Choice
On April 9, 2010, James Westby wrote:
> Hi,
>
> Just a heads up that might save you a few minutes of head-scratching.
>
> I have a branch playing in ec2 right now to catch problems with
> exporting Choices. If you do this then you can't actually use the
> attributes through the API, but the normal way that webservice tests
> are written doesn't catch it.
>
> If you are doing something like:
>
> some_person = exported(Choice(vocabulary=SomeGroupOfPeople))
>
> then you will now see
>
> AssertionError: You exported some_person as an IChoice based
> on an SQLObjectVocabularyBase, you should use
> lazr.restful.fields.ReferenceChoice instead.
>
> which is trying to be helpful and telling you that you instead
> need to do
>
> from lazr.restful.fields import ReferenceChoice
>
> some_person = exported(ReferenceChoice(vocabulary=SomeGroupOfPeople,
> schem=IPerson))
>
> All users of the broken way in the current tree should be fixed
> (anything that isn't is really broken), but you may find this as you
> export something new.
>
Wow, thanks a lot James for cleaning this up!
--
Francis J. Lacoste
francis.lacoste@xxxxxxxxxxxxx
Attachment:
signature.asc
Description: This is a digitally signed message part.
References