[Zope-CMF] Problem adding Portal Images programatically

Chris Withers chrisw@nipltd.com
Tue, 09 Oct 2001 14:32:30 +0100


Tres Seaver wrote:
> 
> 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 )
> 

yay! :-)

I've been fighting with this for a few months now btu never did figure otu how
to fix it...

Chris