[Grok-dev] summary templating/skinning discussion
Kevin Smith
kevin at mcweekly.com
Tue May 22 11:16:28 EDT 2007
> Kevin, what do you think needs to be done for a)? I'm quite interested
> in starting that integration work, as I have the impression we're
> quite far along in this.
>
From the doctests of the ksmith_mcweekly-layers branch, here is the
implementation as is. All tests pass, if there is consensus on the
naming, it's ready for merge.
grok.layer(IBasicSkin)
class MySkinLayer(grok.ILayer): # inherits from IDefaultBrowserLayer
pass
class MySkin(grok.Skin):
grok.layer(MySkinLayer)
grok.name('myskin') # this is actually the default
class Mammoth(grok.Model):
pass
class CaveDrawings(grok.View):
pass # uses module-level grok.layer(IBasicSkin)
cavedrawings = grok.PageTemplate("""\
<html>
<body>
<h1>Hello, world!</h1>
</body>
</html>
""")
class MoreDrawings(grok.View):
grok.layer(rotterdam) # overrides grok.layer(IBasicSkin)
def render(self):
return "Pretty"
class EvenMoreDrawings(grok.View):
grok.layer(MySkin)
def render(self):
return "Awesome"
More information about the Grok-dev
mailing list