Document Actions

Migrating a Product to Plone 4.0

Filed Under:

Some preliminary results and ideas based on first steps to get Products.Poi working on Plone 4 (not there yet).

Setup your buildout

Soon: add Plone==4.0a1 to the eggs in your buildout.cfg

Now: add your egg to the development buildout: http://tr.im/TryPlone4

Example buildout.cfg for Products.Poi

[buildout]
extends = buildout.cfg
auto-checkout +=
    Products.Poi
    Products.AddRemoveWidget
    Products.DataGridField

[sources]
Products.Poi = svn https://svn.plone.org/svn/collective/Products.Poi/trunk
Products.AddRemoveWidget = svn https://svn.plone.org/svn/archetypes/Products.AddRemoveWidget/trunk
Products.DataGridField = svn https://svn.plone.org/svn/archetypes/Products.DataGridField/trunk

[instance]
eggs +=
    Products.Poi

Things to test

  • Does bin/buildout work?
  • Does the instance start up in the foreground?
  • Can you install your product?
  • Can you create/view your content type?
  • Do the tests pass?

Highlights

  • Python2.6, Zope 2.12, CMF 2.2
  • No more global_defines.pt

Poi Example 1

ImportError: No module named Interface

Poi Example 2

ImportError: No module named GlobalTranslationService
  • use zope.i18n

Old:

from Products.PageTemplates.GlobalTranslationService \
    import getGlobalTranslationService 
ts = getGlobalTranslationService() 
msg = ts.translate('Poi', msg, context=self.context)

New:

from zope.i18n import translate 
msg = translate(msg, 'Poi', context=self.request) 

[Update: you need to pass the request instead of the context.]

Plone 3.x and 4?

Compatibility can work:

try:
    from beer import Grolsch
except ImportError:
    # BBB
    from beer import Heineken

or maybe not:

install_requires=[
    'Plone>=4.0dev',
],