[Zope-CMF] Problem adding Portal Images programatically

Tres Seaver tseaver@palladion.com
Thu, 4 Oct 2001 21:53:36 -0400 (EDT)


On 5 Oct 2001, Florent Guillaume wrote:

> Speaking about invokeFactory, I wanted to mention a little bug:
> constructInstance builds the object by calling the factory method (or
> the script), then sets the portal_type using _setPortalTypeName. But it
> never reindexes the object, which means that this portal_type is not
> catalogged until the next object edition (usually). This is a problem
> for me because I have a site where I do a lot of searches on
> portal_type.
> 
> Would a "ob.reindexObject()" at the end of constructContent be an
> acceptable patch ?

Yep,  I just checked this in:

--- TypesTool.py	13 Aug 2001 21:44:18 -0000	1.19
+++ TypesTool.py	5 Oct 2001 13:47:38 -0000
@@ -755,6 +755,8 @@
         
         ob = apply(info.constructInstance, (container, id) + args, kw)
 
+        ob.reindexObject()
+
         if RESPONSE is not None:
             immediate_url = '%s/%s' % ( ob.absolute_url()
                                       , info.immediate_view )

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com