[Zope-CMF] Bad interaction between CMF 1.4 and Zope 2.8 (catalog-getObject-raises)

Florent Guillaume fg at nuxeo.com
Thu Apr 14 13:12:20 EDT 2005


Sidnei da Silva  <sidnei at awkly.org> wrote:
> Hi,
> 
> I'm facing a small issue with CMF 1.4 and the new 'feature' in Zope 2.8
> of letting exceptions through if getObject fails, instead of returning
> None.
> 
> Specifically, in CMFCatalogAware.reindexObjectSecurity (recently
> introduced by Florent Guillaume if I recall), it assumes getObject()
> will return None in a failure.

Yes, see http://www.zope.org/Collectors/CMF/337 which I'm about to fix.

> This results in a traceback like this:
> 
>   Module Products.CMFDefault.DiscussionItem, line 311, in createReply
>   Module Products.CMFCore.CMFCatalogAware, line 102, in
>   notifyWorkflowCreated
>   Module Products.CMFCore.WorkflowTool, line 360, in notifyCreated
>   Module Products.CMFCore.WorkflowTool, line 706, in
>   _reindexWorkflowVariables
>   Module Products.CMFCore.CMFCatalogAware, line 81, in
>   reindexObjectSecurity
>   Module Products.ZCatalog.CatalogBrains, line 74, in getObject
>   Module OFS.Traversable, line 232, in restrictedTraverse
>   Module OFS.Traversable, line 181, in unrestrictedTraverse
>    - __traceback_info__: ([], '1113527681')
>   Module Products.CMFDefault.DiscussionItem, line 224, in
>   __bobo_traverse__
> AttributeError: 'dict' object has no attribute 'RESPONSE'
> 
> There's two things going on here:
> 
> 1. It is wrong in assuming getObject will return None. Well, actually
>    it wasn't, but the carpet has been took away from under us :)

I'll change this.

> 2. If I understand correctly, it's trying to traverse to the
>    newly-created DiscussionItem which though it's indexed, will not be
>    available but two lines after the top-level call, on createReply,
>    line 313.
> 
> I assume there's a reason for the object to be indexed before being
> stored, so I won't try to guess what the correct fix is.

I'm not sure there's a good reason. This code looks quite dumb to me. It
should do a _setObject and _getOb and do the rest of the edit,
addCreator, etc.

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg at nuxeo.com


More information about the Zope-CMF mailing list