Personal tools
You are here: Home Documentation Error References AttributeError regarding NoneType in Catalog Results
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 regarding NoneType in Catalog Results

This Error Reference applies to: Any version.
This Error Reference is intended for: Any audience.

While using .getObject() on a brain (the values returned by a catalog search result) a NoneType can be returned. This will cause an AttributeError in Zope 2.7; in Zope 2.8 it raises an exception either KeyError or AttributeError immedaitely.

If your catalog gets out of sync the paths in the catalog will not resolve. Prior to Zope 2.8 you would end up with a NoneType when you called .getObject on a brain. i.e.:

    for b in catalog(id='foo'):
        if b.getObject() is None:
            raise ValueError, 'This catalog entry is no longer in sync'

Typically you want to fix this and find out where in your application this is happening. There are a few ways of looking at it: for instance brains usually have a .getURL attribute that you can see where the location of the object is suppose to be.

There are numerous ways a brain could return None or an exception (in Zope 2.8) - for instance a ConflictError.

by Alan Runyan last modified May 25, 2005 - 00:32 All content is copyright Plone Foundation and the individual contributors.

Steps to find and fix?

Posted by Graham Perrin at June 28, 2006 - 11:35

For the benefit of those of us who are not too familiar with the ZMI, please, can someone offer advice on how to find and resolve errors of this type?

'NoneType' object has no attribute 'Title'

Posted by Graham Perrin at June 28, 2006 - 11:35

1) whilst editing any object for which related content can be specified, in the pop-up window for selecting related content, if I search for terms graham or perrin (my forename and surname) Plone presents the following AttributeError:

NoneType object has no attribute Title

Not logged

Posted by Graham Perrin at June 28, 2006 - 12:20

Incidentally, this error leaves nothing in the error log.

'NoneType' object has no attribute 'getId'

Posted by Graham Perrin at June 28, 2006 - 11:36

2) Whilst editing an article's links, if I browse for links, in the pop-up window (a slightly different dialogue) if I search for the same terms a different AttributeError occurs and does appear in the log:

NoneType object has no attribute getId

How to Resync Catalog

Posted by Alan Runyan at June 28, 2006 - 13:50
The simplest way to resync a Catalog is to Update it.
ZMI -> portal_catalog -> Advanced tab -> Update Catalog button.

Depending on size of the system this could take a very long time.

Running Zope 2.8.x series or greater should decrease None entries in catalogs.

Catalog update does not resolve the issue

Posted by Graham Perrin at June 28, 2006 - 14:42

Thanks for the prompt response :-)

Beyond a normal update, which unfortunately did not resolve the problem, portal_catalog has also been cleared then rebuilt (Find Objects dialogue, finding all objects). Still the error occurs.

Further details at http://article.gmane.org/gmane.comp.web.zope.plone.user/53971/

I note Zope 2.9.3 included with the new Plone 2.5 installer for Mac OS X 10.4, but our Mac OS X Server is currently limited to 10.3.9.

Considering the symptoms/circumstances, how confident can we be that an upgrade to 2.5 might resolve the issue?

On one hand, I might shift the service to a host that's running Mac OS X 10.4...

...on the other hand, the site in which the error occurs is an experiment, a proof-of-concept before we select Plone for a production environment. Which makes me rather keen to resolve the issue without resorting to major/minor OS/Plone upgrades!

TIA for any further thoughts.

Best, Graham


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