Friday, July 4, 2014

AttributeError: render from plone.app.i18n.locales.languageselector

After migrating a Plone 3.3 site to Plone 4.3.3, the language selector refused to display:

error while rendering plone.app.i18n.locales.languageselector 

The log showed:

2014-07-04 10:39:11 ERROR plone.app.viewletmanager rendering of plone.portalheader in plone.app.i18n.locales.languageselector fails: render
Traceback (most recent call last):
  File "/Users/kees/.buildout/eggs/plone.app.viewletmanager-2.0.5-py2.6.egg/plone/app/viewletmanager/manager.py", line 105, in render
    html.append(viewlet.render())
  File "/Users/kees/.buildout/eggs/zope.viewlet-3.7.2-py2.6.egg/zope/viewlet/viewlet.py", line 59, in render
    raise AttributeError("render")
AttributeError: render


After googling for it, i found that a similar issue had existed in plonetheme.classic: https://dev.plone.org/ticket/12007 which referred to this commit: https://github.com/plone/plonetheme.classic/commit/3f36218d7b7e62a29fb67191eb6af49dd8242f2e

So i did an analogous change, replacing my existing viewlet registration:

           name="plone.app.i18n.locales.languageselector"
       for="*"
       manager="plone.app.layout.viewlets.interfaces.IPortalHeader"
       layer=".interfaces.IThemeSpecific"
       class="Products.LinguaPlone.browser.selector.TranslatableLanguageSelector"
       permission="zope.Public"
       />

With this:

 
               name="plone.app.i18n.locales.languageselector"
         for="*"
         manager="plone.app.layout.viewlets.interfaces.IPortalHeader"
         layer="argh.plonetheme.browser.interfaces.IThemeSpecific"
         class="Products.LinguaPlone.browser.selector.TranslatableLanguageSelector"
         template="locales/browser/languageselector.pt"
         permission="zope.Public"
         />
 

That fixed it.

No comments: