[Grok-dev] Re: grok.layer branch

Leonardo Rochael Almeida leo at enfoldsystems.com
Tue Apr 17 11:45:22 EDT 2007


On 4/17/07, Philipp von Weitershausen <philipp at weitershausen.de> wrote:
> [...]
> kevin at mcweekly.com wrote:
> > [...]
> > The following pattern works...
> >
> > class  Debug(grok.Layer):
> >     pass
> >
> > class Public(grok.Layer):
> >     pass
> >
> > class Dev(Public, Debug):
> >     pass
> >
> > grok.defineskin('Public', Public) # ++skin++Public
> > grok.defineskin('Dev', Debug)     # ++skin++Dev
>
> I wonder why you call this *define*skin. You're actually not defining
> the skin here, you're just registering a layer as a skin.

If I may, why not:

@grok.register_skin('Public')
class Public(grok.Layer):
    """ The Public skin, with a skin name defined in the decorator"""

@grok.register_skin()
class Dev(Public, Debug):
    """ The Development Skin, with a name defined implicitly by the
class name """

> > class DebugView(grok.View):
> >     grok.layer(DebugLayer) #also settable at module level
> >
> > Functional tests are defined and pass, unit tests still need to be
> > defined. Perhaps grok.defineskin should be grok.define_skin
>
> Definitely.
>
> > and grok.layer may be clearer as grok.use_layer or grok.set_layer.
>
> When we came up with "grok.context()", my argument for calling it that
> way was that the object it makes a declaration for will be
> "self.context" on the adapter/view/...
>
> So why not call it "grok.request()"?

IMHO, the intent of grok.context(SomeClassOrInterface) is clear
enough. grok.request(SomeLayer) doesn't seem that clear, at least not
for me...

I'd suggest grok.for_layer() or grok.at_layer()

-- 
Leonardo Rochael Almeida
Enfold Systems
http://www.enfoldsystems.com
phone. +1.713.942.2377 Ext 215
fax. +1.832.201.8856


More information about the Grok-dev mailing list