[Grok-dev] what to use for examples of adapters?
Brandon Craig Rhodes
brandon at rhodesmill.org
Wed Jun 4 00:10:12 EDT 2008
On Thursday morning, I will give a presentation here at the NOLA Plone
Symposium on the "Zope 3 Component Architecture." It's going to be my
Walk-Like-a-Duck talk from PyCon, but extended, so that after explaining
the wonder of a dynamic adapter framework, I will talk a bit about how
adapters are actually used.
I can, of course, list dozens of places in Zope where adapters come into
play, many of which I only dimly understand at this point (permissions,
roles, viewlets, etcetera). But my instinct is to stick close to
bright, obvious examples that I, not to mention my audience, might
understand; the three concepts that come to mind are grok.Traverser,
grok.View, and IAbsoluteURL. With a triad of such adapters, I know how
to take an object which isn't designed for the web at all and (a) make
it available at a URL the user submits, (b) make it render an HTML page,
and (c) make the framework aware of the object's URL so that if it's
returned in a search result or something I can turn it into a link.
A nice slide based on these three adapters could show the innocent,
unharmed object at the center, sitting surrounded by the three adapters
that form its interface to the web. This could be quite a revelation to
Plone people, who, last I checked, deal daily with object with literally
a hundred or more methods because, to support every conceivable web
operation and interface at once, they multiply inherit from, as far as I
can tell, pretty much every superclass available in their framework. :-)
But Derek suggested to me this morning, as I outlined to him the
direction my talk was taking, that, instead of a pure Zope 3 example to
round out the end of my talk, I might want to focus instead on something
that could be written in five.grok since that's a technology that Plone
people can use in their own sites.
And so:
- Does anyone know whether five.grok would support the three adapters
that I list above, that let you get an arbitrary Python class and
suit it up for the web? (traverser / view / absoluteurl?)
- Is there some other combination of adapters that would make more
sense if I did want to conclude my talk with a five.grok example?
- How does one try out and run the test suite of five.grok? I
downloaded it and ran "python2.4 bootstrap.py", and got the
error... oh, wait, never mind, the error about not being able to get
a suitable distribution of "buildout" disappeared. It's now happily
building out. ... 5 test failures. They were ugly ones. I'll look
over the package tomorrow.
Anyway, thanks for any advice or pointers.
--
Brandon Craig Rhodes brandon at rhodesmill.org http://rhodesmill.org/brandon
More information about the Grok-dev
mailing list