Personal tools
You are here: Home Documentation Error References AttributeError: _length
Support

Get Help

Join our chat rooms or support forums if you have more specific questions.

Plone Training
Learn how to design, build, and deploy a website in Plone through one of the numerous Plone training sessions around the world.
Find Plone training…
 
Document Actions

AttributeError: _length

Warning: This item is marked as outdated.

This Error Reference applies to: Plone 2.1.x, Plone 2.0.x
This Error Reference is intended for: Any audience.

When you upgrade from Zope 2.7.x to 2.8.1 you get this error on most of the portal_catalog operations.

Note from the editor: This fix is included in the migration mechanism in the Plone 2.1.1 release and newer. So this should only happen if you are upgrading to the exact 2.1.0 release while upgrading your Zope from 2.7 to 2.8 at the same time.

I got this error message when moving Plone 2.1 from Zope 2.7.5 (Debian / Sarge) and 2.7.9 (FreeBSD) to Zope 2.8.1, but the same problems can be result of upgrading also Plone 2.0.5 to Plone 2.1 along with zope upgrade.

When you get this error after upgrade try the following steps to make successfull upgrade:

  1. install Zope 2.8.1 and Plone 2.1
  2. copy the Data.fs from your 2.7.x instance
  3. start new Zope
  4. go to the ZMI
  5. open portal_catalog inside your Plone instance
  6. you will get an "AttributeError, _length
  7. call the "manage_convertIndexes" method of the ZCatalog (by replacing the "manage_main" part of the URL with "manage_convertIndexes") - the URL should look something like this: http://localhost:8080/plonesite/portal_catalog/manage_convertIndexes
  8. depending on the size of your ZCatalog the migration may take a while
    • After the conversion a message will appear: "Indexes converted and reindexed".
  9. create new Python Script in portal_skins/custom folder with id (fix_catalog or whatever) and replace it's sample code with the following code:
    • return len(context.portal_catalog)
  10. save the script and click on Test tab in the top of page
    • You'll see a number appear, that's the number of items in your catalog. At the same time, your catalog length attrtibute will have been converted,
  11. go back to portal_catalog and click on Update Catalog button which can be found on Advanced tab
  12. open uid_catalog and click on Update Catalog button which is also on Advanced tab
  13. return back to fixing script fix_catalog and change the line of code to the following:
    • return len(context.reference_catalog)
  14. save the script and click on Test tab in the top of page
    • You'll see a number appear, that's the number of references in reference catalog. At the same time, your catalog length attrtibute will have been converted,
  15. open reference_catalog and updated by the same way as in previous catalogs updates

Thanx for help here:

by Lukas Zdych last modified February 20, 2006 - 08:02 All content is copyright Plone Foundation and the individual contributors.

Forcing a 2.7 to 2.8 catalog upgrade

Posted by Laurence Rowe at February 22, 2007 - 15:40
On the file system create a file named convert_indexes.py with:

from Products.CMFPlone.migrations.v2_1.alphas import migrateCatalogIndexes
import transaction
if __name__ == '__main__':
portal = app.Plone
out = []
migrateCatalogIndexes(portal, out)
for line in out:
print line
transaction.get().commit()

Stop zope and then do a ./bin/zopectl run convert_indexes.py

Change the id of your plone site to fit.

For any issues with the web site functionality, please file a ticket.

Please consult the policy on plone.org content if you want your content published on this site.

Servers and hosting by