12. May 2013

How to fix broken style in Plone

Some Products for Plone are little bit broken and uninstallation procedure does not work very well. When you install and then uninstall crappy product you might end up with messed layout of Plone portal.

That’s the time to pay a visit to plone_css folder in ZMI.

Remove any reference to broken style (whole box with style has yellow color) and click Save to reset Plone CSS caching system.

11. May 2013

Plone Error: There is a version conflict. We already have: distribute 0.6.38

I was trying to update one very old instance of Plone configured by buildout. Result of running ./bin/buildout was this error message:

While:
  Installing.
  Loading extensions.
Error: There is a version conflict.
We already have: distribute 0.6.38

There was distribute package installed on system which caused conflict. The solution was to remove the package:

apt-get remove --purge python-zc.buildout

That leads to another error message that buildout script is outdated. Correction:

curl -O http://downloads.buildout.org/2/bootstrap.py
python bootstrap.py

There was another error after using latest version of buildout:

While:
  Installing.
  Getting section instance.
  Initializing section instance.
  Installing recipe plone.recipe.zope2instance.
Error: There is a version conflict.
We already have: zope.interface 3.6.1

Solution was same as before. Just remove zope.interface package from system:

apt-get remove --purge python-zope.interface

After this small fix it was possible to run buildout without any problem.

Update: I encountered this issue again. This time it was necessary to delete develop-eggs directory and restart buildout again.

29. September 2012

Plone upgrade – Clear and Rebuild failed

Plone is not working very well when portal_catalog is not up-to-date. This happens after upgrades. It is recommended to go to portal_catalog, section Advanced and run: Clear and Rebuild.

I did this, but after few seconds I’ve got this fancy error:

Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module Products.CMFPlone.CatalogTool, line 460, in manage_catalogRebuild
Module plone.app.discussion.patches, line 45, in patchedClearFindAndRebuild
Module Products.ZCatalog.ZCatalog, line 287, in manage_catalogClear
Module Products.ZCatalog.Catalog, line 102, in clear

If you dig deep down into ZCatalog code, then you’ll see that some objects in DB simply don’t have clear method. Those objects are typically some ancient instances of TextIndex or instance of some long dead product.

Solution is to catch this error and remove those old grumpy objects from DB. Here is small patch:
eggs/Products.ZCatalog-2.13.23-py2.7.egg/Products/ZCatalog/Catalog.py:

    def clear(self):
        """ clear catalog """

        self.data = IOBTree()  # mapping of rid to meta_data
        self.uids = OIBTree()  # mapping of uid to rid
        self.paths = IOBTree()  # mapping of rid to uid
        self._length = BTrees.Length.Length()
        to_delete = []

        for index in self.indexes.keys():
            try:
                self.getIndex(index).clear()
            except:
                LOG.error('unclearable object %s. ' % str(index))
                to_delete.append(index)

        for del_index in to_delete:
            LOG.error('Removing from index %s. ' % str(del_index))
            del self.indexes[del_index]

Remove eggs/Products.ZCatalog-2.13.23-py2.7.egg/Products/ZCatalog/Catalog.pyc file to avoid caching. Start the Plone and run Clear and Rebuild function. Watch log file also for error messages from ZCatalog.

29. September 2012

Plone buildout problem – We already have zc.buildout

If you want to upgrade Plone just with buildout, then you may find following funny error:

 Installing.
 Loading extensions.
 Error: There is a version conflict.
 We already have: zc.buildout 1.5.2

Typical cause of this problem is that your bin/buildout is out of date. Solution is simple. Remove bin directory. Download latest version of bootstrap.py and let it generate new version of bin/buildout for you. Run biuldout again 🙂

wget http://svn.zope.org/*checkout*/zc.buildout/trunk/bootstrap/bootstrap.py
python bootstrap.py
./bin/buildout