Announcing plone.grok: Grok on Plone!
(Small note: This package may very well be renamed in the near future).
On day 2 of the Paris Sprint Godefroid and me worked on plone.grok, making specific grokkers for some Plone things. Yesterday we make a grokker for GenericSetup import steps, and today we made a grokker for portlets in Plone. Or, well, during the afternoon we did. Before lunch we mostly talked politics. Well, sprints are supposed to be fun too, right!? 🙂
OK, it doesn’t look like much, and the Python code do do this is still a but more complicated than I think is necessary, but we need to discuss with both Grok and Plone people to figure out how it should best be done, and what simplifications we can do.
Here is the code to create the above portlet:
from plone import grok from zope.interface import Interface from zope.interface import implements class IExamplePortlet(Interface): pass class Renderer(grok.Renderer): def render(self): return self.data.title class ExamplePortlet(grok.Portlet): implements(IExamplePortlet) grok.provides(IExamplePortlet) grok.name('ExamplePortlet') grok.portlet_renderer(Renderer) title = "This is my fantastic portlet"
As you see, it’s a simplification from the current way, and best of all: There is no ZCML needed. You still need the GenericSetup profiles portlet.xml, though. I want to get rid of that too, but I want to hear from Plone people if they want it as well.