Using Zope Adapters
This page is a companion to my PyCon 2008 talk, “How to use Grok to Walk like a duck.” It will grow and expand over the next few days as I answer questions and improve my examples.
To start with, here are my slides from the presentation:
I have also prepared some example source code based on my talk for those who want to see a simple adapter in operation. To use it, unpack the tar archive, make sure that you have your Python “dev” package installed for your own operating system (since running the following buildout will try to build a C-language Python module), and:
$ cd messagetree $ python bootstrap.py $ bin/buildout
The above commands, if they succeed, will create a self-contained development environment called a “buildout”, which you can read more about on my buildout page! Once the buildout is completed, you can run the example like this:
$ bin/run
You will see the components of a MIME email message print out as a tree. If you look inside of the source code, you will see how this occurs; the “run” command calls the function defined in “scripts.py”, so you might want to start reading there.
I’ll add more to this page over the next week. Stay tuned!

[...] apresentação do Brandon Rhodes (aqui) começou lembrando um raciocínio estabelecido pelo Alex Martelli (da palestra anterior) sobre os [...]
March 15th, 2008 at 9:21 pm[...] Walking Like a Duck Great presentation about why Zope’s adapter pattern is way, way better than subclassing and monkeypatching. Even I now understand. (tags: presentations python software) [...]
March 20th, 2008 at 7:24 pm[...] Brandon C Rhodes: Using Grok to Walk Like a Duck I already use the Zope component architecture, so I don’t need convincing. However, Brandons slides do a good job in explaining why it’s a good thing to use. [...]
March 21st, 2008 at 4:22 am[...] Let’s discuss the matter further » Using Zope Adapters Posted on March 26th, 2008 by john. Categories: Zope.Una de las mejores presentaciones acerca de por qué la “arquitectura de componentes” de Zope 3, es decir, la parte más básica de las librerías de zope 3, que no tienen nada que ver (necesariamente) con aplicaciones web sino que son mucho más generales, es tan buenísima: Let’s discuss the matter further » Using Zope Adapters [...]
March 26th, 2008 at 9:41 am