[Grok-dev] Get default directive

Paul Wilson paulalexwilson at gmail.com
Wed Jan 6 19:39:42 EST 2010


2010/1/7 Martijn Faassen <faassen at startifact.com>:
> Paul Wilson wrote:
>
>> Also, context.txt contains the following test:
>>
>> ----------------- %< ------------------
>> There are too many possible contexts::
>>
>>   >>> class ambiguouscontext(FakeModule):
>>   ...   class A(Context):
>>   ...     pass
>>   ...   class B(Context):
>>   ...     pass
>>   ...   class C(object):
>>   ...     pass
>>   >>> from martiantest.fake import ambiguouscontext
>>   >>> context.bind(get_default=get_default_context).get(ambiguouscontext.B)
>>   Traceback (most recent call last):
>>     ...
>>   GrokError: Multiple possible contexts for <class
>> 'martiantest.fake.ambiguouscontext.B'>, please use the 'context'
>> directive.
>> ----------------- %< ------------------
>>
>> Shouldn't this be...
>>
>> context.bind(get_default=get_default_context).get(ambiguouscontext.C)
>>
>> ?? I was assuming that A and B were the ambiguous contexts, and C is
>> the subject from which we should be deriving the context.
>
> I think you are right.
>
>> Strangely,
>> this test passes on trunk, but fails with my fake module version....
>
> Before or after fixing it? Interesting!

In its original (trunk) form, the test passes with the FakeModule
class system. When I use my manuel fake module version on the test, it
fails - (I think it finds the context object 'A'). I don't quite
understand why at the moment! I *need* to get to the bottom of this
before I can be sure of my work, so I'll take a fresh look tomorrow.

Thanks,
Paul


More information about the Grok-dev mailing list