[Zope-CMF] Problem adding Portal Images programatically
Jens Vagelpohl
jens@zope.com
Fri, 5 Oct 2001 08:45:17 -0400
florent,
CMFCore.PortalContent has a call to indexObject inside manage_afterAdd,
this should get invoked unless you have special content that grabs a
different manage_afterAdd because of its inheritance hierarchy (i've come
up against that myself before).
jens
On Friday, October 5, 2001, at 12:33 , 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 ?
>
>
> Florent
>
>
> Jens Vagelpohl <jens@zope.com> wrote:
>> if you use invokeFactory instead of addImage in your createImage method
>> then the portal type gets set correctly as well as cataloging and
>> workflow
>> stuff.
>>
>> check CMFCore/PortalFolder.py for details, it takes an argument
>> "type_name"
>> ('Image' in this case) and an id. then you grab a reference to this new
>> image and set the image contents (the "file" argument) by using the
>> image'
>> s edit method (see CMFDefault/Image.py)
>>
>> jens
> --
> Florent Guillaume, Nuxeo SARL (Paris, France)
> +33 1 40 33 79 87 http://nuxeo.com mailto:fg@nuxeo.com
>
> _______________________________________________
> Zope-CMF maillist - Zope-CMF@zope.org
> http://lists.zope.org/mailman/listinfo/zope-cmf
>
> See http://www.zope.org/Products/PTK/Tracker for bug reports and feature
> requests