[Grok-dev] Re: registering a factory as a (global) utility

Martijn Faassen faassen at startifact.com
Fri Apr 27 13:35:00 EDT 2007


Martijn Faassen wrote:
> Hey,
> 
> Martijn Faassen wrote:
> 
>> It's still useful to have this for global utilities, though. I propose 
>> the following alternate directive to do this:
>>
>> grok.global_utility_object(Item, provides=IMyFactory)
>>
>> I chose a separate directive because making global_utility take either 
>> a factory or an instance requires all kinds of extra checks and is not 
>> as readable as having a separate directive. I'm not sure I'm happy 
>> about the name though.
> 
> Thinking about this some more, I've changed my mind, and I think we 
> should do:
> 
> grok.global_utility(Item, provides=IMyFactory, factory=True)
> 
> This will allow us to define a factory=True argument for local 
> utilities. The effect in both cases will be that the first argument 
> won't be called but registered directly.

Hm, I will do this, but I will reverse the semantics. if 'factory=True', 
the default, the first argument is considered to be a factory. If false, 
the first argument is registered directly.

Regards,

Martijn




More information about the Grok-dev mailing list