#231 — LangueIndex relies on getCanonical() returning object

State Resolved
Version:
Area Functionality
Issue type Bug
Severity Medium
Submitted by Mikko Ohtamaa
Submitted on Jan 04, 2010
Responsible
Target release: 3.x
The may fail in Products.LinguaPlone.LanguageIndex::

        if ITranslatable.isImplementedBy(obj):
            cid = obj.getCanonical().UID()
        else:
            # Also index non-translatable content, otherwise
            # LinguaPlone only shows translatable content.
            # This assumes a catalog documentId will never
            # be equal to a UID.
            cid = documentId

obj.getCanonical() may return None in special circumstances. AttributeError is raised.

Sufficient workaround seems to be::

  if ITranslatable.isImplementedBy(obj):
            canonical = obj.getCanonical()
            if canonical is None:
                return 0
            cid = canonical.UID()
        else:
            # Also index non-translatable content, otherwise
            # LinguaPlone only shows translatable content.
            # This assumes a catalog documentId will never
            # be equal to a UID.
            cid = documentId


This happens for me when I am trying to duplicate Plonen site through ZMI - maybe the orignal canonical content has been removed, making the site uncopyable.
Steps to reproduce:
1. Create a broken canonical object

2. Try to clone Plone site in ZMI by copy-paste
Added by Hanno Schlichting on Feb 02, 2010 02:52 PM
Issue state: UnconfirmedResolved
Target release: None3.x
Patch applied in SVN. This will be part of 3.0.1.

No responses can be added.