Re: PyProtocols: TypeError: Ambiguous adapter choice
Sergey Schetinin <[email protected]> Fri, 10 Jul 2009 19:56:52 +0300
| Newsgroups | gmane.comp.python.peak |
|---|---|
| Message-ID | <[email protected]> |
Are you sure it's the "foo = FooOneAsFoo(ComposedFoo())" producing the error? Could it actually be IFoo(ComposedFoo()) ? 2009/7/10 luper rouch <[email protected]>: > The following code produces an error: > > TypeError: ('Ambiguous adapter choice', <class > '__main__.FooOneAsFoo'>, <class '__main__.FooTwoAsFoo'>, 2, 2) > > --- code begins --- > > from protocols import Interface, advise > > class IFoo(Interface): > pass > > class IFooOne(Interface): > pass > > class IFooTwo(Interface): > pass > > class FooOneAsFoo(object): > advise( > instancesProvide=[IFoo], > asAdapterForProtocols=[IFooOne] > ) > > class FooTwoAsFoo(object): > advise( > instancesProvide=[IFoo], > asAdapterForProtocols=[IFooTwo] > ) > > class ComposedFoo(object): > advise( > instancesProvide=[IFooOne, IFooTwo] > ) > > --- code ends --- > > Why is it ambiguous to write for example: > > foo = FooOneAsFoo(ComposedFoo()) > > foo has an IFoo interface, adapted from the IFooOne interface of ComposedFoo. > _______________________________________________ > PEAK mailing list > [email protected] > http://www.eby-sarna.com/mailman/listinfo/peak > -- Best Regards, Sergey Schetinin http://s3bk.com/ -- S3 Backup http://word-to-html.com/ -- Word to HTML Converter