[Grok-dev] Re: viewlets, pagelets and friends

Darryl Cousins darryl at darrylcousins.net.nz
Fri Aug 10 03:41:03 EDT 2007


Hi Luis,

On Fri, 2007-08-10 at 01:32 +0200, Luis De la Parra wrote:
> 
> ok. never mind my last post.
> I just had a look at the internals of grok.View and z3c.pagelet and I
> think
> I'm starting to understand the differences... 

Mars packages simply aim to acheive the component registration normally
done with zcml.

For example:

  <z3c:pagelet
      name="index.html"
      for="zope.app.folder.interfaces.IFolder"
      class=".site.Overview"
      layer="path.to.IMyLayer"
      permission="path.to.mypermissions.View"
      />

  <z3c:template
      template="sites.pt"
      for=".site.Overview"
      layer="z3c.website.layer.IWebSiteBrowserLayer"
      />

would become:

mars.layer.layer(path.to.MyLayer)

class Index(mars.view.PageletView):
        grok.name('index.html')
	grok.context(zope.app.folder.interfaces.IFolder)
        grok.require(path.to.mypermissions.View)

class IndexTemplate(mars.template.TemplateFactory):
        grok.context(Index)
        grok.template('templates/index.pt')

Mars doesn't know about 'static'. I built it that way.

In building mars packages I have come closer to understanding the
component architecture in a way that 2 years with zcml didn't give me.

Where grok couldn't provide me with a registration while duplicating
z3c.formdemo I provided a mars package.

Mars is not perfect.

With sincere regards,
Darryl



More information about the Grok-dev mailing list