[Grok-dev] Re: grok.layer branch

Kevin Smith kevin at mcweekly.com
Tue Apr 17 13:59:04 EDT 2007


I'd like to hear some more grokkers weigh in on grok.layer vs. 
grok.request, I'd like to get this out the door today if possible. :)

I prefer grok.layer because IMO it has more narrowly implied definition 
whereas grok.request has a wider implied definition ( I expect it to do 
more than just assign layers, if even that. )

Philipp von Weitershausen wrote:
> On 17 Apr 2007, at 18:45 , Kevin Smith wrote:
>> Unless someone has an alternate proposal, based on comments by 
>> Philipp and Leonardo, I'm going to reimplement the grok.layer branch 
>> as such...
>>
>> * grok.Layer implements IBrowserRequest
>> * rename grok.layer to grok.for_layer
>
> -1. I certainly prefer grok.layer over grok.for_layer, but I would 
> grok.request prefer even more (following the grok.context() example).
>
>> * rename grok.defineskin to grok.register_skin
>
> +1
>
>> class  Debug(grok.Layer):
>>    pass # grok.Layer inherits from IBrowserRequest
>>
>> class Public(grok.Layer):
>>    pass
>>
>> class Dev(Public, Debug):
>>    pass
>>
>> grok.register_skin('Dev', Dev)
>> grok.register_skin('Public', Public)
>>
>> grok.for_layer(Public)  # define default layer at module level
>>
>> class MyPublicView(grok.View):
>>    """ Uses layer defined at module level by default """
>>    ...
>>
>> class MyDevView(grok.View):
>>    """ Overrides module level layer registration """
>>    grok.for_layer(Dev)
>>    ...
>
> Looks good otherwise!
>
>
>
>


More information about the Grok-dev mailing list