Using Zope Adapters

This page is a companion to my PyCon 2008 talk, “How to use Grok to Walk like a duck.” 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.