Well, every week at least. The work on CMF integration was recently released
as Five 0.3, and last week the announcement that Zope2.8 will integrate Five
and ship with Zope3s component architecture came. So, during the weekend I
decided to put the theory to the test: How hard is it to take a product made
for Five and moving it to Zope 3? Well, there are both easy bits, and
difficult bits. The easy bit are handled by search and replace. They are:

Replacing some Zope2 and Five imports with Zope3 imports.

The difficult bit here is to know what to import. The Zope 2 and Five code
isn't organized the same as the Zope 3 code, so "from Products.Five.a import
b" is not "from zope.a import b" but rather "from zope.app.foo.browser.a
import b". "OFS.Folder" is "zope.app.folder.folder" and so on. So, it's a
matter of trying to load Zope3, getting an import error, figuring out what
it should be, and doing a search and replace on all python files.
Figuring that out is not always easy. For example, Zope2s standard
SimpleItem is usually replaces with the two classes Persistent and
Contained. That's obvious if you know both Zope 2 and Zope 3 well, but not
obvious at all otherwise. Some replacements are almost surprisingly direct,
as the folder example above.

Removing all the five-statements from the zcml

Very quick and easy, of course. Few of them have any Zope3 equivalent, so
it's typically just a matter of deleting them.

Changing portal_tools into local utilities (CMF only)

This is something that requires more of a rewrite. Not only do you need to
rewrite the tools themselves, but all calls to getToolByName needs to be
replaced by getUtility to find the tools.

Rewriting any magic

The less magic you use, the less you will have of this. For example, if you
do any custom traversal, you have to rewrite that. This will be the
trickiest part of any migration, I suspect.

Replacing the CMF macros with zope3 standard macros.

And lastly, this brings us to this weeks improvement. I had to make a search
and replace to replace the CMF-type macro inclusion,
"here/main_template/macros/master", that I used on all pages, to a
Zope3-type inclusion, "context/@@standard_macros/view". But thanks to Sidnei
da Silva, who kicked me in the right direction, Five will soon include
standard support for the Zope3 style inclusion, and with CMFonFive the Zope3
inclusion will end up inserting the CMF-macro. That way you will probably
not have to touch your page templates during the migration. A small step for
man, and a rather tiny step for Five, but a step forward nonetheless.

(Post originally written by Lennart Regebro on the old Nuxeo blogs.)